From: | Andrew Chernow <ac(at)esilo(dot)com> |
---|---|
To: | Gregory Stark <stark(at)enterprisedb(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Martijn van Oosterhout <kleptog(at)svana(dot)org>, Greg Sabino Mullane <greg(at)turnstep(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [PATCHES] libpq type system 0.9a |
Date: | 2008-04-10 13:45:46 |
Message-ID: | 47FE1A0A.2030707@esilo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
Gregory Stark wrote:
> "Andrew Chernow" <ac(at)esilo(dot)com> writes:
>
>> Shoot! Feels like you always miss something.
>>
>> The patch uses PGconn's PQExpBuffer to set errors on a conn. Currently, there
>> is no access to this buffer other than PQerrorMessage. Is the below okay?
>
> Surely you would just provide a function to get pqtypes errors separate from
> libpq errors?
>
That's extremely akward. Consider the below.
int getvalues(PGresult *res, int *x, char **t)
{
return PQgetf(res, "get the int and text);
}
if(getvalues(res, &x, &t))
printf("%s\n", PQresultErrorMessage(res));
How would the caller of getvalues know whether the error was generated
by a libpqtypes API call or by a libpq API call (like PQgetvalue)?
PQgetf should behave exactely as PQgetvalue does, in regards to errors.
Same holds true for PGconn. Normally, you are using PQputf which sets
the error in PQparamErrorMessage. Then there is PQparamCreate(conn) or
PQparamExec(conn, param, ...) and friends? PQparamExec calls
PQexecParams internally which can return NULL, setting an error message
inside PGconn. We felt our light-weight wrappers should be consistent
in behavior. If you get a NULL PGresult for a return value,
PQerrorMessage should be checked.
--
Andrew Chernow
eSilo, LLC
every bit counts
http://www.esilo.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2008-04-10 13:48:48 | Re: Separate psql commands from arguments |
Previous Message | Alvaro Herrera | 2008-04-10 13:42:52 | Re: Commit fest queue |
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2008-04-10 14:12:56 | Re: MSVC build broken with perl 5.10 |
Previous Message | Gregory Stark | 2008-04-10 13:29:21 | Re: [PATCHES] libpq type system 0.9a |