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
oftype 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