[mod_python] Tips and Tricks initiative

Alain Tesio alain at onesite.org
Thu Jul 4 00:06:08 EST 2002

On Wed, 3 Jul 2002 17:38:49 -0500
vio <vmilitaru at sympatico.ca> wrote:

> In fact I see that I am re-using the same connection here, so let me re-phrase my initial
> question: how do I re-use the same *cursor* (or it this a bad idea in the first place).

I think a cursor is not designed to be re-used, what I usually do with cursors is:

- open it
- execute a query
- fetch the rows
- close and remove it (manually with del)

Maybe I'm wrong and a closed cursor can be reopened, I have no idea what
ressources it takes just to create it.

If this works and you want to do it, it can't be shared by two users, you can
use a pool of reusable cursors in a global variable, with a correct lock handling
to make sure you don't get the same cursor from the pool for two users.


More information about the Mod_python mailing list