[freeside-commits] freeside/FS/FS Record.pm,1.135.2.16,1.135.2.17
Ivan,,,
ivan at wavetail.420.am
Sat Jan 9 02:38:08 PST 2010
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv20767
Modified Files:
Tag: FREESIDE_1_7_BRANCH
Record.pm
Log Message:
backport DBIx::DBSchema 0.38 usage from 1.9/HEAD... the alternative is breakage w/ 0.38+ on 1.7
Index: Record.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Record.pm,v
retrieving revision 1.135.2.16
retrieving revision 1.135.2.17
diff -u -d -r1.135.2.16 -r1.135.2.17
--- Record.pm 12 Jul 2009 13:28:28 -0000 1.135.2.16
+++ Record.pm 9 Jan 2010 10:38:06 -0000 1.135.2.17
@@ -9,9 +9,7 @@
use File::CounterFile;
use Locale::Country;
use DBI qw(:sql_types);
-use DBIx::DBSchema 0.25;
-#use DBIx::DBSchema 0.33; #when check for ->can('unique_singles') is sub insert
- #is removed
+use DBIx::DBSchema 0.38;
use FS::UID qw(dbh getotaker datasrc driver_name);
use FS::CurrentUser;
use FS::Schema qw(dbdef);
@@ -743,10 +741,7 @@
#single-field unique keys are given a value if false
#(like MySQL's AUTO_INCREMENT or Pg SERIAL)
- foreach ( $self->dbdef_table->can('unique_singles')
- ? $self->dbdef_table->unique_singles
- : $self->dbdef_table->unique->singles
- ) {
+ foreach ( $self->dbdef_table->unique_singles) {
$self->unique($_) unless $self->getfield($_);
}
@@ -755,12 +750,12 @@
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)
@@ -824,7 +819,7 @@
#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".
More information about the freeside-commits
mailing list