[Bast-commits] r6634 - in
DBIx-Class/0.08/branches/mssql_top_fixes/lib/DBIx/Class/Storage:
. DBI/ODBC
frew at dev.catalyst.perl.org
frew at dev.catalyst.perl.org
Thu Jun 11 18:12:38 GMT 2009
Author: frew
Date: 2009-06-11 18:12:38 +0000 (Thu, 11 Jun 2009)
New Revision: 6634
Modified:
DBIx-Class/0.08/branches/mssql_top_fixes/lib/DBIx/Class/Storage/DBI.pm
DBIx-Class/0.08/branches/mssql_top_fixes/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm
Log:
updated _resolve_column_source to _resolve_column_info as per ribasushi's suggestion
Modified: DBIx-Class/0.08/branches/mssql_top_fixes/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm
===================================================================
--- DBIx-Class/0.08/branches/mssql_top_fixes/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm 2009-06-11 18:03:10 UTC (rev 6633)
+++ DBIx-Class/0.08/branches/mssql_top_fixes/lib/DBIx/Class/Storage/DBI/ODBC/Microsoft_SQL_Server.pm 2009-06-11 18:12:38 UTC (rev 6634)
@@ -17,13 +17,13 @@
$sql .= ';SELECT SCOPE_IDENTITY()' if $op eq 'insert';
my %identity_insert_tables;
- my $col_sources = $self->_resolve_column_sources($ident, [map $_->[0], @{$bind}]);
+ my $col_info = $self->_resolve_column_info($ident, [map $_->[0], @{$bind}]);
foreach my $bound (@{$bind}) {
my $col = $bound->[0];
- my $rsrc = $col_sources->{$col};
- if ($rsrc && $rsrc->column_info($col)->{is_auto_increment}) {
- $identity_insert_tables{$rsrc->from} = 1;
+ if ($col_info->{$col}->{is_auto_increment}) {
+ my $table = $col_info->{$col}->{-result_source}->from;
+ $identity_insert_tables{$table} = 1;
}
}
Modified: DBIx-Class/0.08/branches/mssql_top_fixes/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/branches/mssql_top_fixes/lib/DBIx/Class/Storage/DBI.pm 2009-06-11 18:03:10 UTC (rev 6633)
+++ DBIx-Class/0.08/branches/mssql_top_fixes/lib/DBIx/Class/Storage/DBI.pm 2009-06-11 18:12:38 UTC (rev 6634)
@@ -1309,21 +1309,23 @@
return $alias2source;
}
-# Takes $ident, [$column_names]
+# Takes $ident, \@column_names
#
-# returns { $column_name => $resultsource, ... }
+# returns { $column_name => \%column_info, ... }
+# also note: this adds -result_source => $rsrc to the column info
#
# usage:
-# my $col_sources = $self->_resolve_column_sources($ident, [map $_->[0], @{$bind}]);
-sub _resolve_column_sources {
+# my $col_sources = $self->_resolve_column_info($ident, [map $_->[0], @{$bind}]);
+sub _resolve_column_info {
my ($self, $ident, $colnames) = @_;
my $alias2src = $self->_resolve_ident_sources($ident);
my $name_sep = $self->_sql_maker_opts->{name_sep} || '.';
my %return;
foreach my $col (@{$colnames}) {
- $col =~ s/^([^\Q${name_sep}\E]*)\Q${name_sep}\E//;
+ $col =~ m/^([^\Q${name_sep}\E]*)\Q${name_sep}\E/;
my $alias = $1 || 'me';
- $return{$col} = $alias2src->{$alias};
+ my $rsrc = $alias2src->{$alias};
+ $return{$col} = $rsrc && { %{$rsrc->column_info($col)}, -result_source => $rsrc };
}
return \%return;
}
More information about the Bast-commits
mailing list