mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-12 18:34:36 +08:00
9305fc748c
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 |