-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/27/2010 02:20 PM, Art Age Software wrote:
> I guess the next question is how do I force the affinity to "blob"

The affinity is the type that SQLite will make a reasonable attemp to
convert to for that column, but leave the value as is if the conversion
can't be made.  For example if a column has an affinity of number then when
you insert a string there will be an attempt to convert to number.  If the
conversion succeeds then a number value will be stored otherwise the string
will be stored.

Documentation is at http://www.sqlite.org/datatype3.html

There is no conversion affinity for blob, although you can cast a string to
a blob.  IIRC the last time I tested that cast would also stop at the first
null.

The correct approach is to insert the blob as a blob.  At the C API level
that means using sqlite3_bind_blob, not sqlite3_bind_text as is likely the
case for your situation.  At the SQL level you use X prefix and hex:

  insert .... values( X'7f3c22005d' )

> using the PHP PDO API...

A Google search found these:

  http://bugs.php.net/bug.php?id=41135
  http://bugs.php.net/bug.php?id=42443

Roger


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzI2PgACgkQmOOfHg372QQQKwCghehjHnPHejc9lR7x8AfERsY3
i90An2guvIK0DSGPnP+QqMcyWqwADugX
=SUgM
-----END PGP SIGNATURE-----
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to