views:

12

answers:

1

I'm trying to perform an insert (C++) using different datatypes using execParams, but it keeps saying that the insert is failing. I believe this is because It's interpreting all my datatypes as text because I've set paramTypes to NULL. The documentation says

If parameters are used, they are referred to in the command string as $1, $2, etc. nParams is the number of parameters supplied; it is the length of the arrays paramTypes[], paramValues[], paramLengths[], and paramFormats[]. (The array pointers may be NULL when nParams is zero.) paramTypes[] specifies, by OID, the data types to be assigned to the parameter symbols.

What exactly are these OID's? Are they constants defined to represent different datatypes?

+1  A: 

See the description of OID for postgresql. You can get a list of type names and OIDs by executing the following query:

SELECT typname, oid FROM pg_type;

Also check out the documentation for all the columns in pg_type, just in case.

Gonzalo