Re: C where are oids defined?

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: C where are oids defined?
Дата
Msg-id 1405440583.15301.10.camel@jeff-desktop
обсуждение исходный текст
Ответ на C where are oids defined?  ("frank ernest" <doark@mail.com>)
Список 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
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





В списке pgsql-interfaces по дате отправления:

Предыдущее
От: "frank ernest"
Дата:
Сообщение: C where are oids defined?
Следующее
От: "frank ernest"
Дата:
Сообщение: Re: C where are oids defined?