On 25/02/03 14:29 -0600, Matthew Vanecek wrote:
> It sounds like you've executed a query or command, and have not called
> PQclear(result) on the results. Whenever I've gottten that error, not
> clearing the results has always been the root cause. Make sure result
> is not NULL first, of course...
>
>
The entire code from PQconnect until PQfinish goes like this:
pgconn = PQconnect(init_string);
res = PQexec(pgconn, my_query);
if (res == NULL) quit;
switch( PQresultStatus(res) ) { case ... goto _end; case ... goto _end; ... default ...
goto_end; }
PQclear(res); res = NULL;
_end: if (res) PQclear(res);
PQfinish(pgconn);
This is pretty much the skeleton of the code, as you can see, I treat res
pretty carefully, PQclear it whenever necessary.
Thanks
Wei