[Bast-commits] r6630 -
DBIx-Class/0.08/branches/mssql_top_fixes/lib/DBIx/Class/Storage
frew at dev.catalyst.perl.org
frew at dev.catalyst.perl.org
Thu Jun 11 17:39:01 GMT 2009
Author: frew
Date: 2009-06-11 17:39:00 +0000 (Thu, 11 Jun 2009)
New Revision: 6630
Modified:
DBIx-Class/0.08/branches/mssql_top_fixes/lib/DBIx/Class/Storage/DBI.pm
Log:
general function to go from column names and ident to result source
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 17:08:35 UTC (rev 6629)
+++ DBIx-Class/0.08/branches/mssql_top_fixes/lib/DBIx/Class/Storage/DBI.pm 2009-06-11 17:39:00 UTC (rev 6630)
@@ -1309,6 +1309,25 @@
return $alias2source;
}
+# Takes $ident, [$column_names]
+#
+# returns { $column_name => $resultsource, ... }
+#
+# usage:
+# my $col_sources = $self->_resolve_column_sources($ident, [map $_->[0], @{$bind}]);
+sub _resolve_column_sources {
+ 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//;
+ my $alias = $1 || 'me';
+ $return{$col} = $alias2src->{$alias};
+ }
+ return \%return;
+}
+
sub count {
my ($self, $source, $attrs) = @_;
More information about the Bast-commits
mailing list