"Serdar Tumgoren" <[email protected]> wrote

Is there any reason why you can't reuse the same cursor object? I know
when you're writing to a database, you have to be sure to commit your
changes. But if I'm just issuing execute statements and then fetching
data, is it okay to reuse the same cursor?

No, there is no reason. You can reuse a single cursor as often as you like provided you are happy to take responsibility for keeping the transactions clean - eg not trying to read data from one while writing at the same time, or combining two different selects, and committing between each change transaction.

But most folks find multiple cursors easier to manage in the same way that they find multiple variables easier than reusing a minimal number.

HTH,

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to