Re: [sqlite] System.Data.SQLite blob column exception

2011-05-06 Thread Tim Butterfield
Original Message- > From: [email protected] > [mailto:[email protected]] On Behalf Of Tim Butterfield > Sent: Friday, May 06, 2011 9:31 AM > To: General Discussion of SQLite Database > Subject: Re: [sqlite] System.Data.SQLite blob column excepti

Re: [sqlite] System.Data.SQLite blob column exception

2011-05-06 Thread Robert Simpson
ehalf Of Tim Butterfield Sent: Friday, May 06, 2011 9:31 AM To: General Discussion of SQLite Database Subject: Re: [sqlite] System.Data.SQLite blob column exception I am using a DbDataReader to return the columns for a SQL SELECT statement. For the blob column, I am calling reader.GetOrdinal to ge

Re: [sqlite] System.Data.SQLite blob column exception

2011-05-06 Thread Tim Butterfield
[email protected]] On Behalf Of Tim Butterfield > Sent: Friday, May 06, 2011 8:58 AM > To: General Discussion of SQLite Database > Subject: Re: [sqlite] System.Data.SQLite blob column exception > > On Fri, May 6, 2011 at 7:44 AM, Simon Slavin wrote: >> >> On 6 May 2011, a

Re: [sqlite] System.Data.SQLite blob column exception

2011-05-06 Thread Robert Simpson
: General Discussion of SQLite Database Subject: Re: [sqlite] System.Data.SQLite blob column exception On Fri, May 6, 2011 at 7:44 AM, Simon Slavin wrote: > > On 6 May 2011, at 3:43am, Tim Butterfield wrote: > >> The blob values are always inserted and read as a byte[].  If those >

Re: [sqlite] System.Data.SQLite blob column exception

2011-05-06 Thread Simon Slavin
On 6 May 2011, at 4:58pm, Tim Butterfield wrote: > I'm using the System.Data.SQLite interface and not the direct C > interface methods. All of my inserts are done using DbParameter (@p1, > @p2, etc.) and DbCommand insert statements. The DbParameter.Value is > the C# object type. In the case of

Re: [sqlite] System.Data.SQLite blob column exception

2011-05-06 Thread Tim Butterfield
On Fri, May 6, 2011 at 7:44 AM, Simon Slavin wrote: > > On 6 May 2011, at 3:43am, Tim Butterfield wrote: > >> 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. > > Ar

Re: [sqlite] System.Data.SQLite blob column exception

2011-05-06 Thread Simon Slavin
On 6 May 2011, at 3:43am, Tim Butterfield wrote: > 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. Are you binding your parameters ? If so, check that you're using

Re: [sqlite] System.Data.SQLite blob column exception

2011-05-05 Thread Tim Butterfield
On Thu, May 5, 2011 at 7:16 PM, Simon Slavin 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 someth

Re: [sqlite] System.Data.SQLite blob column exception

2011-05-05 Thread Stephan Beal
On Fri, May 6, 2011 at 2:16 AM, Simon Slavin wrote: > 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 shou

Re: [sqlite] System.Data.SQLite blob column exception

2011-05-05 Thread Simon Slavin
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

[sqlite] System.Data.SQLite blob column exception

2011-05-05 Thread Tim Butterfield
SQLiteDataReader.VerifyType thows an exception if it does not find matching DbType and TypeAffinity. I found a case where a select on several columns, one of which is type blob, had TypeAffinity.Text for that column instead of TypeAffinity.Blob. If the column has binary data, TypeAffinity.Blob(4)