Re: Practical Cursors
Joe Conway <joseph.conway@home.com>
From: "Joe Conway" <joseph.conway@home.com>
To: "Command Prompt, Inc." <pgsql-general@commandprompt.com>, <pgsql-general@postgresql.org>
Date: 2001-09-17T21:56:42Z
Lists: pgsql-general
> However, using something like PHP will not allow this because HTTP is > stateless and PostgreSQL will not know from one transaction to the next > that the results of the connection are related. > > Is this truly the case, or is there a way for PostgreSQL to remember the > connection identifier so that the next time a PHP connection is made with > the same identifier a transaction can be completed? > > Sincerely, > > Joshua Drake > I have actually been thinking recently about just this question. I looked through the source for the PHP pgsql extension and it is clear that no cursor is used. There is, however, the ability to open a persistent connection to PostgreSQL from PHP. I think it would be possible to create a persistent resource identifier to a cursor in a similar manner, and "reuse" the cursor across multiple HTTP requests. The downside I can see is that PHP would have no way to know when it could garbage-collect the allocated resource. So while it could be done, what would happen when the user closes their browser with your cursor still open? -- Joe