From: ivan Date: Sat, 9 Jan 2010 10:04:27 +0000 (+0000) Subject: need DBIx::DBSchema w/quoted_default to make this all work right :/ X-Git-Tag: freeside_1_9_2~131 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=fdc2f00747d6dc30fe0cedad97da1c374e0c8600 need DBIx::DBSchema w/quoted_default to make this all work right :/ --- diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm index ef8ef0026..201e7b23c 100644 --- a/FS/FS/Record.pm +++ b/FS/FS/Record.pm @@ -15,7 +15,7 @@ use Locale::Country; use Text::CSV_XS; use File::Slurp qw( slurp ); use DBI qw(:sql_types); -use DBIx::DBSchema 0.33; +use DBIx::DBSchema 0.38; use FS::UID qw(dbh getotaker datasrc driver_name); use FS::CurrentUser; use FS::Schema qw(dbdef); @@ -962,12 +962,12 @@ sub insert { my $db_seq = 0; if ( $primary_key ) { my $col = $self->dbdef_table->column($primary_key); - + $db_seq = uc($col->type) =~ /^(BIG)?SERIAL\d?/ || ( driver_name eq 'Pg' && defined($col->default) - && $col->default =~ /^nextval\(/i + && $col->quoted_default =~ /^nextval\(/i ) || ( driver_name eq 'mysql' && defined($col->local) @@ -1032,7 +1032,7 @@ sub insert { #my $oid = $sth->{'pg_oid_status'}; #my $i_sql = "SELECT $primary_key FROM $table WHERE oid = ?"; - my $default = $self->dbdef_table->column($primary_key)->default; + my $default = $self->dbdef_table->column($primary_key)->quoted_default; unless ( $default =~ /^nextval\(\(?'"?([\w\.]+)"?'/i ) { dbh->rollback if $FS::UID::AutoCommit; return "can't parse $table.$primary_key default value".