Okay, my mistake, but the test still passes here. I basically run this<https://gist.github.com/890120>and it passes. Does this fail on your end?
On Mon, Mar 28, 2011 at 12:10 PM, Kristoffer Jansson < [email protected]> wrote: > There's a bug in that test. You're testing against the original > entity, and not what you're getting from the database. If I test > against "readback", the test fail, see: https://gist.github.com/890120 > > // Kristoffer > > On Mar 26, 10:56 am, Hadi Eskandari <[email protected]> wrote: > > Kristoffer, > > > > I have slightly modified and applied your test, to the trunk version of > > JetDriver. It looks like this <https://gist.github.com/888143> now, but > the > > test is passing without applying your patch. I can even see in the Output > > window that the query ran on the db is like this: > > > > NHibernate: INSERT INTO DecimalEntity (SimpleDecimal, SimpleDouble, > > NullableDecimal, NullableDouble, Id) VALUES (?, ?, ?, ?, ?);@p0 = 1.1, > @p1 = > > 1.2, @p2 = 1.3, @p3 = 1.4, @p4 = 0 > > > > NHibernate: SELECT this_.Id as Id0_0_, this_.SimpleDecimal as > > SimpleDe2_0_0_, this_.SimpleDouble as SimpleDo3_0_0_, > this_.NullableDecimal > > as Nullable4_0_0_, this_.NullableDouble as Nullable5_0_0_ from > DecimalEntity > > this_ WHERE this_.Id = ?;@p0 = 0 > > > > and as you can see decimal points are all there in case of Decimal or > Double > > data types. I know you mentioned the repro is tricky but I need a failing > > test here to make sure the bug is correctly patched. Could you help out? > Did > > you run the test you provided before applying the patch and it failed? > > > > Thanks, > > Hadi > > > > On Mon, Mar 21, 2011 at 8:12 PM, Kristoffer Jansson < > > > > > > > > > > > > > > > > [email protected]> wrote: > > > I ran into a problem with the JetDriver and decimals a while ago when > > > working with MS Access databases, but I have no idea how to > > > contribute, so I'll just post it here. > > > > > The problem arises when you're trying to save a value of type decimal > > > in the database. Regardless of whether the designated column is a > > > double, or an actual decimal doesn't seem to matter. What happens is > > > that the decimal separator magically disappears. So saving '1.2' would > > > result in the value '12' in the database. > > > > > The fix is making decimals into doubles before saving to database. > > > Similar as to how the code already makes Int64 into Int32. This works > > > on both double and decimal columns. > > > > > I've no idea how to write an automated test to verify this, except > > > actually having a database lying around and try to store and read back > > > the data. Even then I'm not sure if the test could be used safely as > > > it's not very isolated. There may be some twisted environment of > > > drivers etc where the error wouldn't show up. > > > > > Anyway, I've seen this exact behavior on our systems as well as > > > customers, so it doesn't seem like it's only me :) > > > > > Here's a patch that fixes the problem: > > >http://www.itstod.se/files/jetdriver_decimal_to_double_fix.patch > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "NHibernate Contrib - Development Group" group. > > > To post to this group, send email to [email protected]. > > > To unsubscribe from this group, send email to > > > [email protected]. > > > For more options, visit this group at > > >http://groups.google.com/group/nhcdevs?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "NHibernate Contrib - Development Group" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/nhcdevs?hl=en. > > -- You received this message because you are subscribed to the Google Groups "NHibernate Contrib - Development Group" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhcdevs?hl=en.
