[Mono-list] Bug (?) in SqliteDataReader

Nikki Locke nikki at trumphurst.com
Tue May 16 07:30:03 EDT 2006


Joshua Tauberer wrote:
> Nikki Locke wrote: 
> > Oh, pity. Try http://www.trumphurst.com/Test.cs.html for the test program. 
> > I'd be interested to see what results you get? It probably depends on whether 
> > you are in the US or not. 
>  
> So, to recap what is happening: 
>  
> You insert the string '2006-05-11 11:45:00' into a DATE column. 
>  
> SqliteDataReader sees it's a string in a DATE column and uses 
> DateTime.Parse() on it, yielding a DateTime.  Since the input is 
> unambiguous, this is fine in any culture (afaik) and presumably yields 
> the correct date. 
>  
> Somewhere in the process of filling the DataTable, the DateTime is 
> converted back to a string because GetSchemaTable says the column is 
> string-typed.  The conversion yields a culture-dependent string.  *This* 
> is where the Windows/Linux difference is because this is the only point 
> where different code is executing on Windows/Linux. 
>  
> I don't know anything about DataTables so I'm not the person to be 
> looking into that, though. 
>  
> Your patch might be good, but it might just be masking another problem 
> that should be fixed.  I'm not sure.  (If anyone else reading has some 
> thoughts...)

Your summary is accurate, except that the Windows code is pure Microsoft plus 
Finisar.Sqlite, so is probably completely different. The Mono code is clearly 
wrong, anyway - even if DateTimes _should_ be returned as strings (which I doubt), 
they shouldn't be strings on which calling DateTime.Parse results in the wrong 
date.

If I hear nothing more here, I will report this as a bug.

-- 
Nikki Locke, Trumphurst Ltd.      PC & Unix consultancy & programming
http://www.trumphurst.com/




More information about the Mono-list mailing list