From: | Jeff Davis <pgsql(at)j-davis(dot)com> |
---|---|
To: | frank ernest <doark(at)mail(dot)com> |
Cc: | pgsql-interfaces(at)postgresql(dot)org |
Subject: | Re: C where are oids defined? |
Date: | 2014-07-15 16:09:43 |
Message-ID: | 1405440583.15301.10.camel@jeff-desktop |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
On Tue, 2014-07-15 at 17:36 +0200, frank ernest wrote:
> Hi, I'm new and I can't seem to figure out what values are permitted for OID
> PQexecPrepared(parrentcon, insertstmt, 2, argz_str, //fixme);
> I've looked in the docs but it's simply evading me. In C the values are of type char * and in the database they are of type varchar(255).
It looks like you're talking about PQprepare(), not PQexecPrepared().
You can just use NULL for the paramTypes argument, and normally postgres
will figure out the type and everything will be fine. Specifying the
types might catch certain kinds of mistakes and might save postgres a
small amount of work.
To specify the types, the OID is the internal ID of the postgres type.
For built-in types, this is constant, and most people #include
"catalog/pg_type.h". That allows you to use a name, like VARCHAROID,
INT4OID, etc.
For user-defined types, the OID might be different on different servers,
so it's quite awkward to specify the OID for a user-defined type.
Regards,
Jeff Davis
From | Date | Subject | |
---|---|---|---|
Next Message | frank ernest | 2014-07-15 16:19:53 | Re: C where are oids defined? |
Previous Message | frank ernest | 2014-07-15 15:36:24 | C where are oids defined? |