[Bast-commits] r7178 - in DBIx-Class/0.08/trunk/lib/DBIx/Class: .
Storage
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Mon Aug 3 10:41:33 GMT 2009
Author: ribasushi
Date: 2009-08-03 10:41:32 +0000 (Mon, 03 Aug 2009)
New Revision: 7178
Modified:
DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm
DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
Log:
Sanify unqualified column bindtype handling
Silence a warning when using a custom {from}
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm 2009-08-03 10:16:04 UTC (rev 7177)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm 2009-08-03 10:41:32 UTC (rev 7178)
@@ -2928,7 +2928,7 @@
for my $j (@$fromspec) {
next if ref $j ne 'ARRAY';
- next if $j->[0]{-relation_chain_depth} < $cur_depth;
+ next if ($j->[0]{-relation_chain_depth} || 0) < $cur_depth;
my $jpath = $j->[0]{-join_path};
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm 2009-08-03 10:16:04 UTC (rev 7177)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBI.pm 2009-08-03 10:41:32 UTC (rev 7178)
@@ -1401,8 +1401,21 @@
my $fqcn = join ('.', $alias, $col);
$bind_attrs->{$fqcn} = $bindtypes->{$col} if $bindtypes->{$col};
- # so that unqualified searches can be bound too
- $bind_attrs->{$col} = $bind_attrs->{$fqcn} if $alias eq $rs_alias;
+ # Unqialified column names are nice, but at the same time can be
+ # rather ambiguous. What we do here is basically go along with
+ # the loop, adding an unqualified column slot to $bind_attrs,
+ # alongside the fully qualified name. As soon as we encounter
+ # another column by that name (which would imply another table)
+ # we unset the unqualified slot and never add any info to it
+ # to avoid erroneous type binding. If this happens the users
+ # only choice will be to fully qualify his column name
+
+ if (exists $bind_attrs->{$col}) {
+ $bind_attrs->{$col} = {};
+ }
+ else {
+ $bind_attrs->{$col} = $bind_attrs->{$fqcn};
+ }
}
}
More information about the Bast-commits
mailing list