FBClient: non-nullable parameter with null value should be sent as nullable
---------------------------------------------------------------------------

                 Key: CORE-3913
                 URL: http://tracker.firebirdsql.org/browse/CORE-3913
             Project: Firebird Core
          Issue Type: Improvement
            Reporter: Mark Rotteveel


In Firebird 2.5.0 and 2.5.1 (and probably earlier), parameters are described 
with the nullability of their columns. If a user of the fbclient library sets 
everything correct for this parameter in the xsqlvar to send a NULL value (eg 
sets sqlind to -1), but does not enable the nullable bit of sqltype, then the 
fbclient will ignore the sqlind value and send the parameter as if it was a NON 
NULL value (eg empty string for (VAR)CHAR, 0 for INT, etc).

I think it would be better if - for sending parameters from client to server - 
the sqlind value is leading, not the nullability flag of sqltype (the server 
doesn't care, as this is exactly what the pure ava implementation of Jaybird 
does).

The current parameter description can lead to situation where you think you are 
using NULL, where in reality you are using the NOT NULL counterpart.

For example:
CREATE TABLE SINGLE_VARCHAR
(
  VARCHARCOLUMN Varchar(1) NOT NULL
);

Now we try to insert using:
INSERT INTO SINGLE_VARCHAR(VARCHARCOLUMN) VALUES (?) 

With the native client and doing everything in the xsqlvar except setting the 
nullable bit of sqltype will result in the empty string being inserted instead 
of getting GDS Exception. 335544347. validation error for column VARCHARCOLUMN, 
value "*** null ***" as the client library will send the value as if it is not 
null.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to