On Friday, January 25, 2013 4:23:23 PM UTC-8, Charles Monteiro wrote:

> Thanks , do you support composed primary keys?I.e multi field , what would 
> be sequel literal symbol syntax, snake case the composed symbol?
> I want to stay db independent, we will have to see what performance is 
> using straight sequel
>
Sequel supports composite keys almost everywhere. In addition to creating 
tables with composite keys (which rohit posted an example of), Sequel 
supports composite primary keys in models and model associations.

The example I gave earlier can be trivially modified to support composite 
keys:

  DB[:table].where(:pk_column1=>pk_value1, 
:pk_column2=>pk_value2).update(hash_of_new_values) 
  DB[:table].where(:pk_column1=>pk_value1, :pk_column2=>pk_value2).delete

You'll probably want to turn off Sequel's identifier mangling unless you 
are using uppercase identifiers on databases that default to uppercase 
(MSSQL, Oracle, DB2) and lowercase identifiers on databases that default to 
lowercase (PostgreSQL).

  DB.identifier_input_method = DB.identifier_output_method = nil

Sequel quotes identifiers by default, so you'll need to use correct case 
for all of your identifiers (recommended) or turn off identifier quoting 
(not recommended).

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/sequel-talk?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to