[Bast-commits] r8527 - in DBIx-Class/0.08/trunk: .
lib/DBIx/Class/Storage t/delete
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Thu Feb 4 10:28:34 GMT 2010
Author: ribasushi
Date: 2010-02-04 10:28:33 +0000 (Thu, 04 Feb 2010)
New Revision: 8527
Added:
DBIx-Class/0.08/trunk/t/delete/complex.t
Modified:
DBIx-Class/0.08/trunk/Changes
DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBIHacks.pm
Log:
Fix bug reported by tommyt
Modified: DBIx-Class/0.08/trunk/Changes
===================================================================
--- DBIx-Class/0.08/trunk/Changes 2010-02-03 16:36:39 UTC (rev 8526)
+++ DBIx-Class/0.08/trunk/Changes 2010-02-04 10:28:33 UTC (rev 8527)
@@ -19,6 +19,8 @@
overloads
- Fix ResultSetColumn improperly selecting more than the requested
column when +columns/+select is present
+ - Fix failure when update/delete of resultsets with complex WHERE
+ SQLA structures
- Fix regression in context sensitiveness of deployment_statements
- Fix regression resulting in overcomplicated query on
search_related from prefetching resultsets
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBIHacks.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBIHacks.pm 2010-02-03 16:36:39 UTC (rev 8526)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Storage/DBIHacks.pm 2010-02-04 10:28:33 UTC (rev 8527)
@@ -459,13 +459,17 @@
for (my $i = 0; $i < @cond; $i++) {
my $entry = $cond[$i];
my $hash;
- if (ref $entry eq 'HASH') {
+ my $ref = ref $entry;
+ if ($ref eq 'HASH' or $ref eq 'ARRAY') {
$hash = $self->_strip_cond_qualifiers($entry);
}
- else {
+ elsif (! $ref) {
$entry =~ /([^.]+)$/;
$hash->{$1} = $cond[++$i];
}
+ else {
+ $self->throw_exception ("_strip_cond_qualifiers() is unable to handle a condition reftype $ref");
+ }
push @{$cond->{-and}}, $hash;
}
}
Added: DBIx-Class/0.08/trunk/t/delete/complex.t
===================================================================
--- DBIx-Class/0.08/trunk/t/delete/complex.t (rev 0)
+++ DBIx-Class/0.08/trunk/t/delete/complex.t 2010-02-04 10:28:33 UTC (rev 8527)
@@ -0,0 +1,35 @@
+use strict;
+use warnings;
+
+use Test::More;
+use lib qw(t/lib);
+use DBICTest;
+
+my $schema = DBICTest->init_schema();
+my $artist_rs = $schema->resultset ('Artist');
+
+my $init_count = $artist_rs->count;
+ok ($init_count, 'Some artists is database');
+
+$artist_rs->populate ([
+ {
+ name => 'foo',
+ },
+ {
+ name => 'bar',
+ }
+]);
+
+is ($artist_rs->count, $init_count + 2, '2 Artists created');
+
+$artist_rs->search ({
+ -and => [
+ { 'me.artistid' => { '!=', undef } },
+ [ { 'me.name' => 'foo' }, { 'me.name' => 'bar' } ],
+ ],
+})->delete;
+
+is ($artist_rs->count, $init_count, 'Correct amount of artists deleted');
+
+done_testing;
+
More information about the Bast-commits
mailing list