On Wed, 2008-01-23 at 10:12 +0700, Konjkov Vladimir wrote:
> in definition of
> .execute(operation[,parameters])
> .....
> A reference to the operation will be retained by the
> cursor. If the same operation object is passed in again,
> then the cursor can optimize its behavior.
>
>
> What meens "the same operation object is passed in again"?
> There's no definition for Class Operation.
>
> May by it meens
>
> SameOperation = "something that just a constant!"
> C =
> cnxn.cursor()
> C.execute("select * from table where a=? and b=?",(1,2))
> C.fetchall()
> C.execute(SameOperation,(3,4))
> C.fetchall()
No, it means this:
sql = "select * from customers where cust_code = ?"
C.execute(sql, (1,))
# ...
C.execute(sql, (2,))
# ...
Assuming that "sql" doesn't get rebound, it'll reference the same string
object as before, hence the cursor object may optimize its behavior by
reusing a previously prepared statement for that query instead of
re-preparing the statement.
HTH,
--
Carsten Haese
http://informixdb.sourceforge.net
_______________________________________________
DB-SIG maillist - [email protected]
http://mail.python.org/mailman/listinfo/db-sig