On Thu, May 5, 2011 at 7:16 PM, Simon Slavin <[email protected]> wrote:
>
> On 6 May 2011, at 12:17am, Tim Butterfield wrote:
>
>> Since my blob column can
>> contain either text or binary file data, both cases are valid.  Does
>> VerifyType need to add a valid DbType.Binary for case
>> TypeAffinity.Text or is something else going on here?
>
> SQLite allows any column to contain values of any type.  If 
> SQLiteDataReader.VerifyType is to respect that then I don't think it has any 
> use at all.  On the other hand, if you choose to use it with your database, 
> then presumably you should be careful not to put anything but binary data in 
> a BLOB column.

The blob values are always inserted and read as a byte[].  If those
bytes are those of a text file, it fails.  If I add a leading 0x00
byte to force it to be binary, it works.  It's quite a kludge, but I
could do that to work around this limitation.  Is this a requirement
for storing the variable sized contents of a variety of file types or
there something else I should consider?

Here's the approximate schema of this table:

stored_file:
row_id integer ...,
name text,
contents blob


Tim
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to