On Oct 15, 2004, at 7:50 AM, Will Leshner wrote:
Sorry if this is terribly obvious, but I'm assuming that, in SQLite3, we can't use the sqlite_exec convenience API to store BLOBs, right? I see that if we go through the VM directly the API allows us to specify a data size, so that it doesn't depend on NULL-terminated C strings. But sqlite_exec does no such thing, right?
Sorry to respond my own question, but I'm digging into the SQLite3 code a bit more and I'm a little confused. I see that sqlite3_prepare takes a SQL statement as a char* and also the number of bytes in the SQL statement. I assumed this was so that you could put BLOB data in the SQL statement. But sqlite3_prepare doesn't seem to actually use the nBytes parameter anywhere. And sqlite3RunParser seems to be running the parse until it finds a NULL byte in the zSql string. In fact, sqlite3RunParser doesn't even take a number of bytes for the SQL string, so I don't see how it could be using that for the length of the string at all.
So I guess my question is: How do you put BLOB (binary) data into a SQLite3 database?