Thanks for your feedback.

It is possible to ensure certain formats for the text column prior to
saving it to a database.  This makes querying this data quite easy in
fact.  Just because the user entered in a form like 2/12/1980, doesn't
mean it has to get stored in that fashion....I would hope that is
obvious, as this should be a concern no matter how you structure your
database.  A simple validation check solves that one.

Finding a value is then as simple as: select all from users_profile
where profile_key = "birthday" and profile value =,>,< "whatever".
Not too difficult.

Here is an SQL statement that works perfectly:
    $sql = 'SELECT * FROM `users_profile` WHERE profile_key = \'email
\' and profile_value = \'andrewpp...@gmail.com\';

Another example.
    $sql = 'SELECT * FROM `users_profile` WHERE profile_key = \'zipcode
\' and profile_value > \'70000\';

The data is not mangled at all, and is still easily retrievable.  It
is, however, very flexible.  I accept that searching through all text
fields can be slower from a performance standpoint than using other
types of fields.

Andrew
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to