From: | "Merlin Moncure" <mmoncure(at)gmail(dot)com> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | "Andrew Dunstan" <andrew(at)dunslane(dot)net>, "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>, "Tom Dunstan" <tom(at)tomd(dot)cc> |
Subject: | Re: [HACKERS] enum types and binary queries |
Date: | 2007-08-31 18:32:34 |
Message-ID: | b42b73150708311132k563c3e94le52989667b8b186f@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
On 8/31/07, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> > Here's a patch (minus catalog bump) which I think does that.
>
> Looks sane in a very quick once-over, but I didn't test it.
works fine (here was my test). thanks for quick resolution to this
issue. strings returned in binary format is IMO ok.
enum.c:
include "libpq-fe.h"
#include "string.h"
#include <stdlib.h>
int main(int argc, char **argv)
{
PGconn *c = PQconnectdb("user=postgres");
PGresult *r;
r = PQexecParams(c, "select 'foo'::foo", 0, NULL, NULL, NULL, NULL, 1);
ExecStatusType t = PQresultStatus(r);
if(t != PGRES_COMMAND_OK & t != PGRES_TUPLES_OK)
{
printf("%s", PQresultErrorMessage(r));
exit(1);
}
char* f = PQgetvalue(r,0,0);
int len = 3;
int format = 1;
PQclear(r);
r = PQexecParams(c, "select $1::foo", 1, NULL, (const char* const
*)&f, &len, &format, 1);
if(t != PGRES_COMMAND_OK & t != PGRES_TUPLES_OK)
{
printf("%s", PQresultErrorMessage(r));
exit(1);
}
PQfinish(c);
}
From | Date | Subject | |
---|---|---|---|
Next Message | Merlin Moncure | 2007-08-31 18:36:59 | Re: [HACKERS] enum types and binary queries |
Previous Message | Andrew Dunstan | 2007-08-31 18:26:01 | Re: enum types and binary queries |
From | Date | Subject | |
---|---|---|---|
Next Message | Merlin Moncure | 2007-08-31 18:36:59 | Re: [HACKERS] enum types and binary queries |
Previous Message | Andrew Dunstan | 2007-08-31 18:26:01 | Re: enum types and binary queries |