While extending Stipe's patch for urlencoded udh's, I've found a bug in 
Sqlbox's PosgreSQL support that would have prevented it from working properly 
in many cases.

On the macros octstr_null_create and atol_null, PQgetvalue was checked for null 
on the condition, and that function only returns empty or 0 for text/numeric 
columns respectively.

That would have caused all null numeric fields to be filled with 0 instead of 
-1. For example, mwi = 0 would mean that messages would arrive as voice mail 
notifications instead of regular sms, and lots of other issues.

This simple patch uses PQgetisnull instead, and fixes the issue. For text 
fields PQgetvalue returns empty when the field is null, so there's no need to 
add a condition at all.

Regards,
--
Alejandro Guerrieri
[email protected]


Attachment: sqlbox_pgsql_nulls.diff
Description: Binary data

Reply via email to