Skip site navigation (1) Skip section navigation (2)

Re: libpq: NULL in binary parameters

From: Andrew McNamara <andrewm(at)object-craft(dot)com(dot)au>
To: john heasley <heas(at)shrubbery(dot)net>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: libpq: NULL in binary parameters
Date: 2007-05-17 23:11:39
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
>Using binary parameters with libpq (PQexecParams) I am having trouble
>figuring out how NULL is represented since there does not appear to be
>For example, if a table has a varchar column and it IS NULL for a given
>row, then what I received is a zero-length string ("").  Also, while I
>can insert a NULL varchar simply by setting the value to NULL (or 0), it
>is not clear how to acheive this with say an integer column.  And, is it
>possible to match NULL using a parameter.

The arguments to PQexecParams are all pointers to buffers, even in the
case of ints. To send a NULL, simply pass a null pointer for that value.

Andrew McNamara, Senior Developer, Object Craft

In response to

pgsql-interfaces by date

Next:From: Y. Ming LamDate: 2007-05-21 04:33:28
Subject: PQgetvalue failed to get non-text data under binary format
Previous:From: john heasleyDate: 2007-05-17 16:48:00
Subject: libpq: NULL in binary parameters

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group