Thanks Roger. That does seem to be the problem as the type of the
columns is coming back as "text."

I guess the next question is how do I force the affinity to "blob"
using the PHP PDO API...

Sam

On Wed, Oct 27, 2010 at 2:12 PM, Roger Binns <rog...@rogerbinns.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 10/27/2010 11:48 AM, Art Age Software wrote:
>> New to this list and hoping someone can help. I have a sqlite3
>> database that contains a couple of tables that have binary data in
>> BLOB columns.
>
> Note that there is column affinity, but the data stored for a particular
> column can differ per row.
>
>> I know the data is in there and stored correctly because
>> the application accessing the database can retrieve the column data
>> just fine.
>
> That doesn't prove it :-)
>
>> The problem is that the .dump command produces a dump file with
>> seemingly truncated BLOB columns.
>
> The single most likely cause is that the data is actually stored as text not
> blobs.  The easiest way to check is this:
>
>   select distinct typeof(columnname) from tablename;
>
> When you supply "text" to SQLite APIs (the ones ending in _text) they are
> expected to be UTF8 encoded bytes.  However SQLite does not actually check
> that it is valid UTF8 encoding.  Consequently it is possible to insert
> random binary data using the text APIs and for it appear to all work 
> correctly.
>
> The dump code stops at the first null in any text value but will correctly
> output a blob value.
>
> Roger
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkzIlaYACgkQmOOfHg372QSPDQCfcTuAMFa+9vpmBAJ6WMZtCX5M
> opgAoMKc9THDp58KyaWIl9UvOyVQ/Iac
> =82WY
> -----END PGP SIGNATURE-----
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to