-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 08/17/2011 09:25 PM, Ivan Shmakov wrote: > Somehow, I've assumed that sqlite3_bind_blob () will bind a > parameter to a blob.
It does. There are no affinity rules that will cause otherwise. There are some operations that cause blobs to be silently promoted to strings. IMHO these are egregious errors in SQLite since a bucket of bytes cannot be turned into characters unless you know the encoding which SQLite doesn't. Here is an example: sqlite> select X'616263' || 'd'; abcd sqlite> select typeof(X'616263' || 'd'); text Consequently if you had a trigger pulling a stunt like this, your code could try to insert a blob and silently (wrongly) end up with a string. SQLite won't even complain if the blob isn't a valid text encoding producing an invalid string. sqlite> select X'8989' || 'd'; ��d sqlite> select typeof(X'8989' || 'd'); text sqlite> select hex(X'8989' || 'd'); 898964 sqlite> create table x(y); sqlite> INSERT INTO x values(X'8989' || 'd'); sqlite> .dump PRAGMA foreign_keys=OFF; BEGIN TRANSACTION; CREATE TABLE x(y); INSERT INTO "x" VALUES('��d'); COMMIT; Roger -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk5NBUwACgkQmOOfHg372QQo1gCfXwu15/F97xAqi9VtZq/sjwSb yyMAnihqCFZpRx1BxwkLF3o6miXiNXWm =Ky47 -----END PGP SIGNATURE----- _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users