Hi all,

i have some queries using IN, e.g.

SELECT * FROM t WHERE uuid IN (...);

(uuid is a blob field storing uuids btw.)

Is there a way to use bind variables for this, e.g. something like this:
(python wrapper, this example doesn't work)
cursor.execute("SELECT * FROM t WHERE uuid IN (?)",([uuid1,uuid2],))

Or would i have to create a dynamic query with appropriate number of bind 
variables myself and have to pay the price of reparsing each time?

# like this
values = [uuid1,uuid2]
binders = ",".join("?"*len(values))
cursor.execute("SELECT * FROM t WHERE uuid IN (%s)" % binders, values)

I also had some rather complex piece of SQL from "The Art of SQL", which 
took a string and dissected it in place with subqueries and a join to a 
pivot table, but wondered if there was an easier way to do it?

Michael








-- 
Michael Schlenker
Software Engineer

CONTACT Software GmbH           Tel.:   +49 (421) 20153-80
Wiener Straße 1-3               Fax:    +49 (421) 20153-41
28359 Bremen
http://www.contact.de/          E-Mail: [EMAIL PROTECTED]

Sitz der Gesellschaft: Bremen
Geschäftsführer: Karl Heinz Zachries, Ralf Holtgrefe
Eingetragen im Handelsregister des Amtsgerichts Bremen unter HRB 13215

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to