From: | Wei Weng <wweng(at)kencast(dot)com> |
---|---|
To: | Matthew Vanecek <mevanecek(at)yahoo(dot)com> |
Cc: | pgsql-interfaces(at)postgresql(dot)org |
Subject: | Re: debug a mess |
Date: | 2003-02-25 20:58:20 |
Message-ID: | 20030225155820.B24120@example.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Jeroen T. Vermeulen | 2003-02-25 21:24:26 | Re: debug a mess |
Previous Message | Matthew Vanecek | 2003-02-25 20:44:45 | Re: ECPG and C++ compilation |