From: Rafael Kitover Date: Wed, 10 Jun 2009 12:04:19 +0000 (+0000) Subject: cache rsrc in NoBindVars, use name_sep X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a49fe31273f9306254dd3d0a29cbf765146fcfe0;p=dbsrgits%2FDBIx-Class-Historic.git cache rsrc in NoBindVars, use name_sep --- diff --git a/lib/DBIx/Class/Storage/DBI/NoBindVars.pm b/lib/DBIx/Class/Storage/DBI/NoBindVars.pm index d58ccae..2e8231b 100644 --- a/lib/DBIx/Class/Storage/DBI/NoBindVars.pm +++ b/lib/DBIx/Class/Storage/DBI/NoBindVars.pm @@ -50,14 +50,21 @@ sub _prep_for_execute { my @sql_part = split /\?/, $sql; my $new_sql; + my $result_sources = {}; + foreach my $bound (@$bind) { my $col = shift @$bound; - $col =~ s/^([^.]*)\.//; + my $name_sep = $self->_sql_maker_opts->{name_sep} || '.'; + + $col =~ s/^([^\Q${name_sep}\E]*)\Q${name_sep}\E//; my $alias = $1 || 'me'; - my $datatype = $self->_resolve_ident_sources($ident)->{$alias} - ->column_info($col)->{data_type}; + $result_sources->{$alias} ||= + $self->_resolve_ident_sources($ident)->{$alias}; + my $rsrc = $result_sources->{$alias}; + + my $datatype = $rsrc->column_info($col)->{data_type}; foreach my $data (@$bound) { if(ref $data) {