Re: DBD::Oracle Release Candidate 1
John Scoles <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.dbi.sybase.devel |
|---|---|
| Message-ID | <[email protected]> |
On 18/02/2011 4:12 AM, Charles Jardine wrote: Ok that cleans that one up.. Hopefully I will have some time today to get to that one Thanks John > On 17/02/11 12:34, H.Merijn Brand wrote: >> On Wed, 16 Feb 2011 12:32:12 +0100, "H.Merijn Brand" >> <[email protected]> wrote: >> >>> http://www.pythian.com/news/wp-content/uploads/DBD-Oracle-1.28_RC_1.zip >>> >>> You need to work on longdouble support I guess > > I wrote the tests in question. I included object properties of type > DATE and NUMERIC to provide tests against regression of some changes > I had made to get_attr_val to fix type mismatches. > > I realise that I made a mistake by using literal Perl floating point > numbers in the insert statements. Doing it this way means that, on > the route into Oracle, the number is converted first into Perl's binary > floating point format and then into Oracle's base-100 format. > (I was only interested in testing the route out of Oracle.) > > I think the best fix is simply to use strings in the insert statements. > Change 12345.6789 to '12345.6789' and 777.666 to '777.666'. This > way, the conversions both ways will be done by Oracle. Conversion of > a decimal string representation to a base-100 representation of adequate > precision will be exact. Nothing will be hidden under the carpet. > > I should have written it like this originally. I am sorry. > >> Here's a patch to make the test PASS on all systems, but I'm not sure >> if I'm using a carpet to shuv the problems under ... >> >> --- t/58object.t.org 2011-02-17 13:33:48.000000000 +0100 >> +++ t/58object.t 2011-02-17 13:33:25.000000000 +0100 >> @@ -82,9 +82,9 @@ $dbh->do(qq{ INSERT INTO $table VALUES ( >> or die $dbh->errstr; >> $dbh->do(qq{ INSERT INTO $table VALUES (2, $sub_type(NULL, 'obj2', >> TO_DATE('2004-11-30 14:27:18', 'YYYY-MM-DD >> HH24:MI:SS'), >> - 12345.6789)) } >> + 12345.9375)) } >> ) or die $dbh->errstr; >> -$dbh->do(qq{ INSERT INTO $table VALUES (3, $sub_type(5, 'obj3', >> NULL, 777.666)) } >> +$dbh->do(qq{ INSERT INTO $table VALUES (3, $sub_type(5, 'obj3', >> NULL, 777.875)) } >> ) or die $dbh->errstr; >> >> $dbh->do(qq{ CREATE OR REPLACE TYPE $inner_type AS OBJECT ( >> @@ -159,14 +159,14 @@ ok (scalar @row2, 'new: Fetch second row >> cmp_ok(ref $row2[1], 'eq', 'DBD::Oracle::Object', 'new: Row 2 >> column 2 is an DBD::Oracle::Object'); >> cmp_ok(uc $row2[1]->type_name, "eq", uc "$schema.$sub_type", "new: >> Row 2 column 2 object type"); >> is_deeply([$row2[1]->attributes], ['NUM', undef, 'NAME', 'obj2', >> - 'DATETIME', '2004-11-30T14:27:18', 'AMOUNT', >> '12345.6789'], "new: Row 1 column 2 object attributes"); >> + 'DATETIME', '2004-11-30T14:27:18', 'AMOUNT', >> '12345.9375'], "new: Row 1 column 2 object attributes"); >> >> @row3 = $sth->fetchrow(); >> ok (scalar @row3, 'new: Fetch third row'); >> cmp_ok(ref $row3[1], 'eq', 'DBD::Oracle::Object', 'new: Row 3 >> column 2 is an DBD::Oracle::Object'); >> cmp_ok(uc $row3[1]->type_name, "eq", uc "$schema.$sub_type", "new: >> Row 3 column 2 object type"); >> is_deeply([$row3[1]->attributes], ['NUM', 5, 'NAME', 'obj3', >> - 'DATETIME', undef, 'AMOUNT', '777.666'], "new: Row 1 >> column 2 object attributes"); >> + 'DATETIME', undef, 'AMOUNT', '777.875'], "new: Row 1 >> column 2 object attributes"); >> >> ok (!$sth->fetchrow(), 'new: No more rows expected'); >> >> @@ -178,7 +178,7 @@ my $expected_hash = { >> NUM => 5, >> NAME => 'obj3', >> DATETIME => undef, >> - AMOUNT => 777.666, >> + AMOUNT => 777.875, >> }; >> is_deeply($obj->attr_hash, $expected_hash, >> 'DBD::Oracle::Object->attr_hash'); >> is_deeply($obj->attr, $expected_hash, 'DBD::Oracle::Object->attr'); >> >> > >