Le 2012-09-17 à 03:53, Ben Sullivan a écrit :

> What are my options for using the Sequel API if I don't know the table and 
> field names for DML and querying until runtime?  All the examples I've seen 
> use symbols.

#to_sym is your friend!

DB[table_name.to_sym].filter(column_name.to_sym => 1).count

Alternatively, you can use #literal, but you have to be mindful of possible SQL 
injections with this though:

table_name = "; DROP TABLE users;"
DB[table_name.literal].all
#=> SELECT * FROM ; DROP TABLE users;

Hope that helps!
François

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

Reply via email to