mysql connection

P

Python_it

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()
 
S

Steve Holden

Python_it said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,270
Messages
2,571,353
Members
48,038
Latest member
HunterDela

Latest Threads

Top