sqlite3_bind_text for null string
I use the codes to access sqlite
sqlite3_bind_text(statement,1,[myString UTF8String],-1,SQLITE_TRANSIENT);
It works. But if myString is NULL, it always causes updatin开发者_如何学运维g the record in table failed. (or nothing changed) How to process when myStrign is NULL?
Welcome any comment
Thanks
Use sqlite3_bind_null(statement, 1);
when your string is NULL.
if (myString)
sqlite3_bind_text(statement,1,[myString UTF8String],-1,SQLITE_TRANSIENT);
else
sqlite3_bind_null(statement,1);
精彩评论