From 345edc39172a87ed0bd473269ff22cd29c279535 Mon Sep 17 00:00:00 2001 From: einhverfr Date: Sun, 6 May 2007 22:25:48 +0000 Subject: Adding type detection so that NUMERIC types from the db are handed off to Math::BigFloat git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1138 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/LedgerSMB.pm b/LedgerSMB.pm index 073a73ab..9f3ac71d 100755 --- a/LedgerSMB.pm +++ b/LedgerSMB.pm @@ -434,7 +434,14 @@ sub call_procedure { $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; -- cgit v1.2.3