[freeside-commits] freeside/FS/FS Record.pm,1.155,1.156

Ivan,,, ivan at wavetail.420.am
Wed Jul 2 20:57:18 PDT 2008


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

Modified Files:
	Record.pm 
Log Message:
real should be bound to SQL_FLOAT Like float4... 1.7?  not touching it unless it breaks :)

Index: Record.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Record.pm,v
retrieving revision 1.155
retrieving revision 1.156
diff -u -d -r1.155 -r1.156
--- Record.pm	28 Jun 2008 23:03:10 -0000	1.155
+++ Record.pm	3 Jul 2008 03:57:16 -0000	1.156
@@ -298,17 +298,15 @@
   foreach my $field (
     grep defined( $record->{$_} ) && $record->{$_} ne '', @real_fields
   ) {
-    if ( $record->{$field} =~ /^\d+(\.\d+)?$/
-         && dbdef->table($table)->column($field)->type =~ /(int|(big)?serial)/i
-    ) {
+    my $value = $record->{$field};
+    my $type = dbdef->table($table)->column($field)->type;
+    if ( $type =~ /(int|(big)?serial)/i && $value =~ /^\d+(\.\d+)?$/ ) {
       $sth->bind_param($bind++, $record->{$field}, { TYPE => SQL_INTEGER } );
-    }elsif ( $record->{$field} =~ /^[+-]?\d+(\.\d+)?$/
-         && dbdef->table($table)->column($field)->type =~ /(numeric)/i
-    ) {
-      $sth->bind_param($bind++, $record->{$field}, { TYPE => SQL_FLOAT } );
-    }elsif ( $record->{$field} =~ /[-+]?\d*\.?\d+([eE][-+]?\d+)?/
-         && dbdef->table($table)->column($field)->type =~ /(float4)/i
-    ) {
+    } elsif (    ( $type =~ /(numeric)/i     && $value =~ /^[+-]?\d+(\.\d+)?$/)
+              || ( $type =~ /(real|float4)/i
+                     && $value =~ /[-+]?\d*\.?\d+([eE][-+]?\d+)?/
+                 )
+            ) {
       $sth->bind_param($bind++, $record->{$field}, { TYPE => SQL_FLOAT } );
     } else {
       $sth->bind_param($bind++, $record->{$field}, { TYPE => SQL_VARCHAR } );



More information about the freeside-commits mailing list