469,898 Members | 1,779 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

mysql connection

How can I close more cursors at the END of my page,
after execute some scripts/functions.

example:
I use one DB connection and 5 cursor actions.

How can I close these connections/actions at the END of my page?
cursor.close() ==> 5 times??
db.close()

Nov 22 '05 #1
2 1454
Python_it wrote:
How can I close more cursors at the END of my page,
after execute some scripts/functions.

example:
I use one DB connection and 5 cursor actions.

How can I close these connections/actions at the END of my page?
cursor.close() ==> 5 times??
db.close()

If the five cursor actions are all performed on the same cursor then you
only need one cursor.close().

Of course you may also need to delete (or otherwise make available for
garbage collection) the results you have fetched with cursor.fetchall()
and similar methods, but basically you just need to close each cursor
you open once.

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/

Nov 22 '05 #2
Python_it wrote:
How can I close more cursors at the END of my page,
after execute some scripts/functions.

example:
I use one DB connection and 5 cursor actions.

How can I close these connections/actions at the END of my page?
cursor.close() ==> 5 times??
db.close()

If the five cursor actions are all performed on the same cursor then you
only need one cursor.close().

Of course you may also need to delete (or otherwise make available for
garbage collection) the results you have fetched with cursor.fetchall()
and similar methods, but basically you just need to close each cursor
you open once.

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006 www.python.org/pycon/

Nov 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Mike Chirico | last post: by
11 posts views Thread by DJJ | last post: by
1 post views Thread by zMisc | last post: by
oll3i
5 posts views Thread by oll3i | last post: by
3 posts views Thread by tulika dutta | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.