use strict;
use warnings FATAL => 'all';
+use Data::Dumper;
+
use Test::More;
+
+plan ( tests => 4 );
+
use lib qw(t/lib);
use DBICTest;
use DBIC::SqlMakerTest;
-plan tests => 4;
-
-my $schema = DBICTest->init_schema();
-my $art_rs = $schema->resultset('Artist');
+my $schema = DBICTest->init_schema();
+my $art_rs = $schema->resultset('Artist');
+my $cdrs = $schema->resultset('CD');
{
my $arr = $art_rs->as_query;
- my ($query, @bind) = @$arr;
+ my ($query, @bind) = @{$$arr};
is_same_sql_bind(
$query, \@bind,
- "SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me", [],
+ "(SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me)", [],
);
}
{
my $arr = $art_rs->as_query;
- my ($query, @bind) = @$arr;
+ my ($query, @bind) = @{$$arr};
is_same_sql_bind(
$query, \@bind,
- "SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me WHERE ( name = ? )",
+ "(SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me WHERE ( name = ? ))",
[ [ name => 'Billy Joel' ] ],
);
}
{
my $arr = $art_rs->as_query;
- my ($query, @bind) = @$arr;
+ my ($query, @bind) = @{$$arr};
is_same_sql_bind(
$query, \@bind,
- "SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me WHERE ( ( ( rank = ? ) AND ( name = ? ) ) )",
+ "(SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me WHERE ( ( ( rank = ? ) AND ( name = ? ) ) ) )",
[ [ rank => 2 ], [ name => 'Billy Joel' ] ],
);
}
{
my $arr = $rscol->as_query;
- my ($query, @bind) = @$arr;
+ my ($query, @bind) = @{$$arr};
is_same_sql_bind(
$query, \@bind,
- "SELECT me.charfield FROM artist me WHERE ( ( ( rank = ? ) AND ( name = ? ) ) )",
+ "(SELECT me.charfield FROM artist me WHERE ( ( ( rank = ? ) AND ( name = ? ) ) ) )",
[ [ rank => 2 ], [ name => 'Billy Joel' ] ],
);
}