From: Peter Rabbitson Date: Tue, 24 Nov 2009 18:43:42 +0000 (+0000) Subject: Extra sqla quoting test X-Git-Tag: v0.08116~126 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=da562e65be46c52066d195cd39f68904c32db5f8;p=dbsrgits%2FDBIx-Class.git Extra sqla quoting test --- 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;