From: | "Cyril VELTER" <cyril(dot)velter(at)metadys(dot)com> |
---|---|
To: | <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Prepared queries and portals |
Date: | 2004-03-03 20:44:54 |
Message-ID: | 02c401c40160$6304be80$f901a8c0@cvfixe |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
While adapting an application to make use of the new protocol, I've
faced one problem. I cannot execute a prepared query and fetch the result in
several time. The multiple fetch is accessible with cursor in SQL but I
haven't found any way to execute a prepared query in a cursor.
The documentation clearly state that the protocol support this beahvior,
so I've modified libpq to handle the case by adding to functions :
PQexecPreparedPortal(conn,stmtName,portalName,nParams,paramValues,paramlengt
h,paramFormats,resultFormat,maxrows);
and
PQfetchPortal(conn,portalName,maxrows)
PQexecPreparedPortal is a PQexecPrepared clone but you can specify the
portal in which the result should be put (which might be the unnamed one)
and the maximum number of rows to retreive after the execution.
PQfetchPortal fetch the next rows.
This works nicely. I would like to see this included in the standard
libpq, and will submit a patch if this might be usefull, but as it extend
the libpq API there might be more general plan to support the functionality.
Any comments ?
cyril
From | Date | Subject | |
---|---|---|---|
Next Message | Ken Hirsch | 2004-03-03 21:30:37 | Re: [pgsql-hackers-win32] What's left? |
Previous Message | Merlin Moncure | 2004-03-03 20:28:15 | Re: [pgsql-hackers-win32] What's left? |