[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [1138] trunk/LedgerSMB.pm



Revision: 1138
          http://svn.sourceforge.net/ledger-smb/?rev=1138&view=rev
Author:   einhverfr
Date:     2007-05-06 15:25:48 -0700 (Sun, 06 May 2007)

Log Message:
-----------
Adding type detection so that NUMERIC types from the db are handed off to Math::BigFloat

Modified Paths:
--------------
    trunk/LedgerSMB.pm

Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm	2007-05-06 21:40:36 UTC (rev 1137)
+++ trunk/LedgerSMB.pm	2007-05-06 22:25:48 UTC (rev 1138)
@@ -434,7 +434,14 @@
     $query =~ s/\(\)/($argstr)/;
     my $sth = $self->{dbh}->prepare($query);
     $sth->execute(@args);
+    my @types = @{$sth->{TYPE}};
+    my @names = @{$sth->{NAME_lc}};
     while ( my $ref = $sth->fetchrow_hashref('NAME_lc') ) {
+	for (0 .. $#names){
+            if ($types[$_] eq 'NUMERIC'){
+                $ref->{$names[$_]} = Math::BigFloat->new($ref->{$names[$_]});
+            }
+        }
         push @results, $ref;
     }
     @results;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.