condition elements
- Change SQLMaker carp-monkeypatch to be compatible with versions
of SQL::Abstract >= 1.73
+ - Fix using \[] literals in the from resultset attribute
* Misc
- Rewire all warnings to a new Carp-like implementation internal
elsif ($ref eq 'HASH') {
return $_[0]->_recurse_from($_[1]);
}
+ elsif ($ref eq 'REF' && ref ${$_[1]} eq 'ARRAY') {
+ my ($sql, @bind) = @{ ${$_[1]} };
+ push @{$_[0]->{from_bind}}, @bind;
+ return $sql
+ }
}
-
return $_[0]->next::method ($_[1]);
}
use Test::More;
-plan ( tests => 5 );
-
use lib qw(t/lib);
use DBICTest;
use DBIC::SqlMakerTest;
my $subsel_rs = $schema->resultset("CD")->search( { cdid => { IN => $rs->get_column('cdid')->as_query } } );
is($subsel_rs->count, $rs->count, 'Subselect on PK got the same row count');
}
+
+
+is_same_sql_bind($schema->resultset('Artist')->search({
+ rank => 1,
+}, {
+ from => $schema->resultset('Artist')->search({ 'name' => 'frew'})->as_query,
+})->as_query,
+ '(SELECT me.artistid, me.name, me.rank, me.charfield FROM (
+ SELECT me.artistid, me.name, me.rank, me.charfield FROM
+ artist me
+ WHERE (
+ ( name = ? )
+ )
+ ) WHERE (
+ ( rank = ? )
+ )
+ )',
+ [
+ [{ dbic_colname => 'name', sqlt_datatype => 'varchar', sqlt_size => 100 }, 'frew'],
+ [{ dbic_colname => 'rank' }, 1],
+ ],
+ 'from => ...->as_query works'
+);
+
+done_testing;