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) is returned from sqlite3_column_type as
expected.  But, if the column has only text data and not binary data,
that function returns TypeAffinity.Text (3), which causes VerifyType
to fail to match and throw the exception.  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?

Thanks.

In my local copy of the VerifyType code, I made that change, but also
added explanatory data to the exception message to provide more info
as to what was happening.

case TypeAffinity.Text:
...
   if (type == DbType.Binary) return affinity;
   break;
...
}

throw new InvalidCastException(String.Format("Unexpected DbType: {0}
for Affinity: {1}", typ, affinity);

--
Tim Butterfield
http://www.timbutterfield.com/
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to