On Tue, 22 May 2007 17:08:46 -0400, Art Protin wrote 
> Separating out the query would greatly reduce the confusion between 
> parameters 
> and string formatting as then the two would be in separate commands.

Ah, you mean a "prepared statement" object. This topic comes up from time to
time, but there are at least two DB-API implementations (InformixDB and either
mxODBC or cxOracle, or maybe both) that allow prepared statements without the
clutter of a Query object: The cursor object *is* the query object, in essence.

For example, in InformixDB you can write:

conn = informixdb.connect("test")
cur = conn.cursor()
cur.prepare("select * from customer where cust_num = ?")
# later...
cur.execute(cur.command, (1,) )

Instead of cur.command, InformixDB also allows passing None as the statement,
which makes for shorter code if the cursor has a long name, which it might,
since the cursor is being used like a prepared statement, so its name should
reflect what it does.

Best regards,

--
Carsten Haese
http://informixdb.sourceforge.net
_______________________________________________
DB-SIG maillist  -  DB-SIG@python.org
http://mail.python.org/mailman/listinfo/db-sig

Reply via email to