[http://www.sqlite.org/cvstrac/tktview?tn=4040]
The OP is having problems because a sqlite3_bind_text with parameters of (NULL, 0) actually appears to bind null instead. H13533 is somewhat woolly about this.
On examining the code the ultimate cause is clear in bindText (also called to bind a blob). The binding is first cleared (ie set to null).
If the pointer is NULL then nothing else is done, irrespective of the length passed in. The interface requirements do not cover this situation.
I suggest that if the pointer is NULL then SQLITE_MISUSE is returned no matter what the length passed in is. (This is obviously a bug in the application. SQLite would be well within its rights to crash.)
Trying to do clever things (eg ignoring pointer if length is 0) leads to more complications like what the destructor should be etc.
|