[Mono-list] Bug (?) in SqliteDataReader
nikki at trumphurst.com
Fri May 19 06:30:04 EDT 2006
Joshua Tauberer wrote:
> I don't think there should be a database that can't be read using any
> method, even if it wasn't created with Mono.Data.SqliteClient and even
> if it has crazy nonuniform data in columns.
Well, it is currently possible (actually, easy) to write a data row using the
existing Mono.Data.SqliteClient library which cannot be read back!
I have updated the code at http://www.trumphurst.com/Test.cs.html to test this.
I also updated the code to work with Finisar.SQLite under Microsoft .NET.
Just uncomment the line which inserts "a string" to demonstrate.
Basically, storing "a string" in a DateTime field is allowed, but causes
subsequent queries to throw an Exception.
Note also that storing an arbitrary integer in the DateTime field does not
result in a sensible value being returned - the integer has been converted to a
string, then passed through DateTime.Parse().ToString().
I have tried this test code (without the "a string" insert) on my "fixed"
library, and that throws an exception trying to convert the floating point
Trying it under Finisar.SQLite produces the same result as my "fixed" library -
i.e. it throws an exception for the floating point number.
The existing code does not satisfy your requirement. It does allow you to store
and retrieve floating point numbers in DateTime fields, but not arbitrary
strings. I don't see that is significantly better than only allowing parseable
DateTimes in DateTime fields.
The bug in DateTime.Parse which does not correctly parse the output of
DateTime.ToString in certain locales should also be fixed, but I have no idea
where to start with this one, as I haven't unravelled the maze of twisty code
which does the job. Suggestions welcome!
Nikki Locke, Trumphurst Ltd. PC & Unix consultancy & programming
More information about the Mono-list