]> granicus.if.org Git - postgresql/commit
Fixes:
authorMarc G. Fournier <scrappy@hub.org>
Tue, 13 Aug 1996 01:34:29 +0000 (01:34 +0000)
committerMarc G. Fournier <scrappy@hub.org>
Tue, 13 Aug 1996 01:34:29 +0000 (01:34 +0000)
commit9305fc748c21aa12e9360be33c086c58e160ad11
tree81effd39d89fa7d53c37a45cd6799814c5d3da89
parent78d56d0bcb885732a4504f5c442e60ac079a177b
Fixes:

Attached is a patch to allow libpq to determine if a field is null.

This is needed because text fields will return a PQgetlength() of 0
whether it is '' or NULL.  There is even a comment in the source noting
the fact.

I have changed the value of the 'len' field for NULL result fields.  If
the field is null, the len is set to -1 (NULL_LEN).  I have changed
PQgetlength() to return a 0 length for both '' and NULL.  A new function
PQgetisnull() returns true or false for NULL.

The only risk is to applications that do not use the suggested
PQgetlength() call, but read the result 'len' field directly.

As this is not recommended, I think we are safe here.

A separate documentation patch will be sent.

Submitted by: Bruce Momjian <maillist@candle.pha.pa.us>
src/interfaces/libpq/fe-exec.c
src/interfaces/libpq/libpq-fe.h