agora inbox for pgsql-interfaces@postgresql.org  
help / color / mirror / Atom feed
From: Jeff Davis <pgsql@j-davis.com>
To: frank ernest <doark@mail.com>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: C where are oids defined?
Date: Tue, 15 Jul 2014 09:09:43 -0700
Message-ID: <1405440583.15301.10.camel@jeff-desktop> (raw)
In-Reply-To: <trinity-dca89253-43e5-406f-9709-0bcfe2629856-1405438583928@3capp-mailcom-lxa07>
References: <trinity-dca89253-43e5-406f-9709-0bcfe2629856-1405438583928@3capp-mailcom-lxa07>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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




-- 
Sent via pgsql-interfaces mailing list (pgsql-interfaces@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-interfaces



view thread (3+ messages)  latest in thread

Message-ID: <1405440583.15301.10.camel@jeff-desktop>
Permalink:  ../1405440583.15301.10.camel@jeff-desktop/
Also on:    postgresql.org/message-id/1405440583.15301.10.camel@jeff-desktop

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: pgsql@j-davis.com, doark@mail.com
  Subject: Re: C where are oids defined?
  In-Reply-To: <1405440583.15301.10.camel@jeff-desktop>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox