[Bast-commits] r7950 - DBIx-Class/0.08/trunk/t

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Tue Nov 24 18:43:43 GMT 2009


Author: ribasushi
Date: 2009-11-24 18:43:42 +0000 (Tue, 24 Nov 2009)
New Revision: 7950

Modified:
   DBIx-Class/0.08/trunk/t/95sql_maker_quote.t
Log:
Extra sqla quoting test

Modified: DBIx-Class/0.08/trunk/t/95sql_maker_quote.t
===================================================================
--- DBIx-Class/0.08/trunk/t/95sql_maker_quote.t	2009-11-24 13:11:02 UTC (rev 7949)
+++ DBIx-Class/0.08/trunk/t/95sql_maker_quote.t	2009-11-24 18:43:42 UTC (rev 7950)
@@ -6,13 +6,6 @@
 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 @@
 );
 
 
+($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 @@
   q/UPDATE [group] SET [name] = ?, [order] = ?/, [ ['name' => 'Bill'], ['order' => '12'] ],
   'bracket quoted table names for UPDATE'
 );
+
+done_testing;




More information about the Bast-commits mailing list