[Bast-commits] r3782 - in DBIx-Class/0.08/trunk: . lib/DBIx/Class
lib/SQL/Translator/Parser/DBIx
ash at dev.catalyst.perl.org
ash at dev.catalyst.perl.org
Tue Sep 25 16:39:52 GMT 2007
Author: ash
Date: 2007-09-25 16:39:52 +0100 (Tue, 25 Sep 2007)
New Revision: 3782
Modified:
DBIx-Class/0.08/trunk/Changes
DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSource.pm
DBIx-Class/0.08/trunk/lib/SQL/Translator/Parser/DBIx/Class.pm
Log:
Throw if "foreign." and "self." are wrong way round in conditions for relationships
Modified: DBIx-Class/0.08/trunk/Changes
===================================================================
--- DBIx-Class/0.08/trunk/Changes 2007-09-25 04:13:40 UTC (rev 3781)
+++ DBIx-Class/0.08/trunk/Changes 2007-09-25 15:39:52 UTC (rev 3782)
@@ -1,5 +1,8 @@
Revision history for DBIx::Class
+ - When adding relationships, it will throw an exception if you get the
+ foreign and self parts the wrong way round in the condition
+
0.08007 2007-09-04 19:36:00
- patch for Oracle datetime inflation (abram at arin.net)
- added on_disconnect_do
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSource.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSource.pm 2007-09-25 04:13:40 UTC (rev 3781)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSource.pm 2007-09-25 15:39:52 UTC (rev 3782)
@@ -519,6 +519,14 @@
unless $cond;
$attrs ||= {};
+ # Check foreign and self are right in cond
+ if ( (ref $cond ||'') eq 'HASH') {
+ for (keys %$cond) {
+ $self->throw_exception("Keys of condition should be of form 'foreign.col', not '$_'")
+ if /\./ && !/^foreign\./;
+ }
+ }
+
my %rels = %{ $self->_relationships };
$rels{$rel} = { class => $f_source_name,
source => $f_source_name,
Modified: DBIx-Class/0.08/trunk/lib/SQL/Translator/Parser/DBIx/Class.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/SQL/Translator/Parser/DBIx/Class.pm 2007-09-25 04:13:40 UTC (rev 3781)
+++ DBIx-Class/0.08/trunk/lib/SQL/Translator/Parser/DBIx/Class.pm 2007-09-25 15:39:52 UTC (rev 3782)
@@ -128,7 +128,6 @@
if($rel_table)
{
-
my $reverse_rels = $source->reverse_relationship_info($rel);
my ($otherrelname, $otherrelationship) = each %{$reverse_rels};
@@ -145,7 +144,6 @@
#Decide if this is a foreign key based on whether the self
#items are our primary columns.
- $DB::single = 1 if $moniker eq 'Tests::MBTI::Result';
# If the sets are different, then we assume it's a foreign key from
# us to another table.
More information about the Bast-commits
mailing list