[freeside-commits] freeside/FS/FS Record.pm,1.135.2.12,1.135.2.13

Ivan,,, ivan at wavetail.420.am
Sat Nov 1 12:53:34 PDT 2008


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv4631

Modified Files:
      Tag: FREESIDE_1_7_BRANCH
	Record.pm 
Log Message:
backport bind_param fixes for DBD:Pg 1.x from 1.9, fixes "Cannot bind ... unknown sql_type 6 on tax report, RT#4133

Index: Record.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Record.pm,v
retrieving revision 1.135.2.12
retrieving revision 1.135.2.13
diff -u -d -r1.135.2.12 -r1.135.2.13
--- Record.pm	14 Aug 2008 01:58:42 -0000	1.135.2.12
+++ Record.pm	1 Nov 2008 19:53:31 -0000	1.135.2.13
@@ -379,17 +379,22 @@
     my $value = $record->{$field};
     #done above in 1.7# $value = $value->{'value'} if ref($value);
     my $type = dbdef->table($table)->column($field)->type;
+
+    my $TYPE = SQL_VARCHAR;
     if ( $type =~ /(int|(big)?serial)/i && $value =~ /^\d+(\.\d+)?$/ ) {
-      $sth->bind_param($bind++, $value, { TYPE => SQL_INTEGER } );
+      $TYPE = SQL_INTEGER;
+
+    #DBD::Pg 1.49: Cannot bind ... unknown sql_type 6 with SQL_FLOAT
     } elsif (    ( $type =~ /(numeric)/i     && $value =~ /^[+-]?\d+(\.\d+)?$/)
               || ( $type =~ /(real|float4)/i
                      && $value =~ /[-+]?\d*\.?\d+([eE][-+]?\d+)?/
                  )
             ) {
-      $sth->bind_param($bind++, $value, { TYPE => SQL_FLOAT } );
-    } else {
-      $sth->bind_param($bind++, $value, { TYPE => SQL_VARCHAR } );
+      $TYPE = SQL_DECIMAL;
     }
+
+    $sth->bind_param($bind++, $value, { TYPE => $TYPE } );
+
   }
 
 #  $sth->execute( map $record->{$_},



More information about the freeside-commits mailing list