[Mono-dev] A bug in the latest SVN System.Data (concurrency exception)?

Marek Habersack grendel at caudium.net
Wed Oct 18 17:22:20 EDT 2006


On Wed, 18 Oct 2006 23:10:20 +0200, Kornél Pál <kornelpal at gmail.com>
scribbled:

> >DateTime dt = new DateTime(0);
> >
> >which yields, for the MySql connector the following string:
> >
> >0001-01-01 00:00:00
> >
> >and I have a field in the database of the date type set to 0,
> >which for MySql renders the string:
> >
> >0000-00-00 00:00:00
> >
> >Now, the command builder builds a command that first sets all the
> >fields and then uses them all in the WHERE clause with the original
> >values - this is the way Mono detects the concurrency problem.
> >Obviously, there is no match for the above datetime field and the
> >entire transaction "fails" - that is, no rows are affected and the
> >exception is thrown. Not sure how to solve it though :)
> 
> Is it possible to pass date values as integers rather than strings?
In theory yes, but not so with stronly typed datasets (which is what
I'm using in this particular application)

> It could solve the problem. Note that 0000-00-00 00:00:00 is an
yep, and Mono represents it as a null value when it reads such form
from the database (both ByteFX and the MySqlConnector)

> invalid date so MySql may store 0001-01-01 00:00:00 using a different
> value that is non-zero. If there is no other solution 0001-01-01
> 00:00:00 and 0000-00-00 00:00:00 should be treated equally by the
> connector.
That's my guess, too. The short term solution is to set the
timestamp/date fields to a default value of 1000-01-01 00:00:00, which
is the minimum date value mysql accepts.

best regards,

marek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20061018/7eca0dfb/attachment.bin 


More information about the Mono-devel-list mailing list