X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F95sql_maker_quote.t;h=d9e40a32648d107a07addfb30dd24e324f9c3feb;hb=da562e65be46c52066d195cd39f68904c32db5f8;hp=e7fbb60eb3ebf75884d68bfefeb8e92fb744e38a;hpb=36b5936987ea98eac8a6d6f57fd983d6127957bb;p=dbsrgits%2FDBIx-Class.git diff --git a/t/95sql_maker_quote.t b/t/95sql_maker_quote.t index e7fbb60..d9e40a3 100644 --- a/t/95sql_maker_quote.t +++ b/t/95sql_maker_quote.t @@ -6,13 +6,6 @@ use Test::More; use lib qw(t/lib); use DBIC::SqlMakerTest; -BEGIN { - eval "use DBD::SQLite"; - plan $@ - ? ( skip_all => 'needs DBD::SQLite for testing' ) - : ( tests => 12 ); -} - use_ok('DBICTest'); my $schema = DBICTest->init_schema(); @@ -235,6 +228,21 @@ is_same_sql_bind( ); +($sql, @bind) = $sql_maker->select( + [ { me => 'cd' } ], + [qw/ me.cdid me.artist me.title /], + { cdid => \['rlike ?', [cdid => 'X'] ] }, + { group_by => 'title', having => \['count(me.artist) > ?', [ cnt => 2] ] }, +); + +is_same_sql_bind( + $sql, \@bind, + q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title` FROM `cd` `me` WHERE ( `cdid` rlike ? ) GROUP BY `title` HAVING count(me.artist) > ?/, + [ [ cdid => 'X'], ['cnt' => '2'] ], + 'Quoting works with where/having scalarrefs', +); + + ($sql, @bind) = $sql_maker->update( 'group', { @@ -330,3 +338,5 @@ is_same_sql_bind( q/UPDATE [group] SET [name] = ?, [order] = ?/, [ ['name' => 'Bill'], ['order' => '12'] ], 'bracket quoted table names for UPDATE' ); + +done_testing;