Re: libpq: NULL in binary parameters

Поиск
Список
Период
Сортировка
От Andrew McNamara
Тема Re: libpq: NULL in binary parameters
Дата
Msg-id 20070517231139.80666600895@longblack.object-craft.com.au
обсуждение исходный текст
Ответ на libpq: NULL in binary parameters  (john heasley <heas@shrubbery.net>)
Список 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
>a NULLOID.
>
>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
http://www.object-craft.com.au/


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

Предыдущее
От: john heasley
Дата:
Сообщение: libpq: NULL in binary parameters
Следующее
От: Jeff Lynn
Дата:
Сообщение: PQgetvalue failed to return column value for non-text data in binary format