[Bast-commits] r7118 -
DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Fri Jul 24 19:22:26 GMT 2009
Author: caelum
Date: 2009-07-24 19:22:25 +0000 (Fri, 24 Jul 2009)
New Revision: 7118
Modified:
DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm
Log:
code cleanup
Modified: DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm
===================================================================
--- DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm 2009-07-24 18:35:37 UTC (rev 7117)
+++ DBIx-Class/0.08/branches/sybase/lib/DBIx/Class/Storage/DBI/Sybase.pm 2009-07-24 19:22:25 UTC (rev 7118)
@@ -181,16 +181,17 @@
my ($sql, $bind) = $self->next::method (@_);
if ($op eq 'insert') {
- my ($identity_insert_on, $identity_insert_off, $identity_col);
my $table = $ident->from;
my $bind_info = $self->_resolve_column_info($ident, [map $_->[0], @{$bind}]);
- $identity_col =
+ my $identity_col =
List::Util::first { $bind_info->{$_}{is_auto_increment} } (keys %$bind_info);
if ($identity_col) {
- $identity_insert_on = "SET IDENTITY_INSERT $table ON";
- $identity_insert_off = "SET IDENTITY_INSERT $table OFF";
+ $sql =
+"SET IDENTITY_INSERT $table ON\n" .
+"$sql\n" .
+"SET IDENTITY_INSERT $table OFF"
} else {
$identity_col = List::Util::first {
$ident->column_info($_)->{is_auto_increment}
@@ -201,9 +202,7 @@
# Sybase has nested transactions, only the outermost is actually committed
$sql =
"BEGIN TRANSACTION\n" .
- ($identity_insert_on ? "$identity_insert_on\n" : '') .
"$sql\n" .
- ($identity_insert_off ? "$identity_insert_off\n" : '') .
$self->_fetch_identity_sql($ident, $identity_col) . "\n" .
"COMMIT";
}
More information about the Bast-commits
mailing list