[Bast-commits] r5374 - DBIx-Class/0.08/branches/stopgap/t

ribasushi at dev.catalyst.perl.org ribasushi at dev.catalyst.perl.org
Thu Jan 29 20:00:16 GMT 2009


Author: ribasushi
Date: 2009-01-29 20:00:16 +0000 (Thu, 29 Jan 2009)
New Revision: 5374

Modified:
   DBIx-Class/0.08/branches/stopgap/t/19quotes.t
   DBIx-Class/0.08/branches/stopgap/t/19quotes_newstyle.t
   DBIx-Class/0.08/branches/stopgap/t/41orrible.t
   DBIx-Class/0.08/branches/stopgap/t/76joins.t
   DBIx-Class/0.08/branches/stopgap/t/91debug.t
   DBIx-Class/0.08/branches/stopgap/t/95sql_maker_quote.t
Log:
Now SQLA 1.50 compatible - no changes to tests, no additions. Just compat

Modified: DBIx-Class/0.08/branches/stopgap/t/19quotes.t
===================================================================
--- DBIx-Class/0.08/branches/stopgap/t/19quotes.t	2009-01-29 18:45:46 UTC (rev 5373)
+++ DBIx-Class/0.08/branches/stopgap/t/19quotes.t	2009-01-29 20:00:16 UTC (rev 5374)
@@ -12,21 +12,19 @@
 }
 
 use lib qw(t/lib);
+use DBIC::SqlMakerTest;
+use DBIC::DebugObj;
 
 use_ok('DBICTest');
 my $schema = DBICTest->init_schema();
 
-my $orig_debugcb = $schema->storage->debugcb;
-my $orig_debug = $schema->storage->debug;
-
 diag('Testing against ' . join(' ', map { $schema->storage->dbh->get_info($_) } qw/17 18/));
 
 $schema->storage->sql_maker->quote_char('`');
 $schema->storage->sql_maker->name_sep('.');
 
-my $sql = '';
-
-$schema->storage->debugcb(sub { $sql = $_[1] });
+my $sql;
+$schema->storage->debugobj(DBIC::DebugObj->new(\$sql));
 $schema->storage->debug(1);
 
 my $rs;
@@ -35,18 +33,37 @@
            { 'me.year' => 2001, 'artist.name' => 'Caterwauler McCrae' },
            { join => 'artist' });
 eval { $rs->count };
-like($sql, qr/\QSELECT COUNT( * ) FROM `cd` `me`  JOIN `artist` `artist` ON ( `artist`.`artistid` = `me`.`artist` ) WHERE ( `artist`.`name` = ? AND `me`.`year` = ? )\E/, 'got correct SQL for count query with quoting');
+ok (eq_sql
+  (
+    $sql,
+    q/SELECT COUNT( * ) FROM `cd` `me`  JOIN `artist` `artist` ON ( `artist`.`artistid` = `me`.`artist` ) WHERE ( `artist`.`name` = ? AND `me`.`year` = ? )/,
+  ),
+  'got correct SQL for count query with quoting'
+);
 
+
 my $order = 'year DESC';
 $rs = $schema->resultset('CD')->search({},
             { 'order_by' => $order });
 eval { $rs->first };
-like($sql, qr/ORDER BY `\Q${order}\E`/, 'quoted ORDER BY with DESC (should use a scalarref anyway)');
+ok (eq_sql
+  (
+    $sql,
+    qq/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY `${order}`/,
+  ),
+  'quoted ORDER BY with DESC (should use a scalarref anyway)'
+);
 
 $rs = $schema->resultset('CD')->search({},
             { 'order_by' => \$order });
 eval { $rs->first };
-like($sql, qr/ORDER BY \Q${order}\E/, 'did not quote ORDER BY with scalarref');
+ok (eq_sql
+  (
+    $sql,
+    qq/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY ${order}/,
+  ),
+  'did not quote ORDER BY with scalarref'
+);
 
 $schema->storage->sql_maker->quote_char([qw/[ ]/]);
 $schema->storage->sql_maker->name_sep('.');
@@ -55,7 +72,13 @@
            { 'me.year' => 2001, 'artist.name' => 'Caterwauler McCrae' },
            { join => 'artist' });
 eval { $rs->count };
-like($sql, qr/\QSELECT COUNT( * ) FROM [cd] [me]  JOIN [artist] [artist] ON ( [artist].[artistid] = [me].[artist] ) WHERE ( [artist].[name] = ? AND [me].[year] = ? )\E/, 'got correct SQL for count query with bracket quoting');
+ok (eq_sql
+  (
+    $sql,
+    qq/SELECT COUNT( * ) FROM [cd] [me]  JOIN [artist] [artist] ON ( [artist].[artistid] = [me].[artist] ) WHERE ( [artist].[name] = ? AND [me].[year] = ? )/,
+  ),
+  'got correct SQL for count query with bracket quoting'
+);
 
 my %data = (
        name => 'Bill',
@@ -66,6 +89,3 @@
 $schema->storage->sql_maker->name_sep('.');
 
 is($schema->storage->sql_maker->update('group', \%data), 'UPDATE `group` SET `name` = ?, `order` = ?', 'quoted table names for UPDATE');
-
-$schema->storage->debugcb($orig_debugcb);
-$schema->storage->debug($orig_debug);

Modified: DBIx-Class/0.08/branches/stopgap/t/19quotes_newstyle.t
===================================================================
--- DBIx-Class/0.08/branches/stopgap/t/19quotes_newstyle.t	2009-01-29 18:45:46 UTC (rev 5373)
+++ DBIx-Class/0.08/branches/stopgap/t/19quotes_newstyle.t	2009-01-29 20:00:16 UTC (rev 5374)
@@ -13,12 +13,12 @@
 
 use lib qw(t/lib);
 
+use DBIC::SqlMakerTest;
+use DBIC::DebugObj;
+
 use_ok('DBICTest');
 my $schema = DBICTest->init_schema();
 
-my $orig_debugcb = $schema->storage->debugcb;
-my $orig_debug = $schema->storage->debug;
-
 diag('Testing against ' . join(' ', map { $schema->storage->dbh->get_info($_) } qw/17 18/));
 
 my $dsn = $schema->storage->connect_info->[0];
@@ -30,28 +30,43 @@
   { quote_char => '`', name_sep => '.' },
 );
 
-my $sql = '';
-$schema->storage->debugcb(sub { $sql = $_[1] });
-$schema->storage->debug(1);
+my $sql;
+$schema->storage->debugobj(DBIC::DebugObj->new(\$sql));
+$schema->storage->debug (1);
 
-my $rs;
-
-$rs = $schema->resultset('CD')->search(
+my $rs = $schema->resultset('CD')->search(
            { 'me.year' => 2001, 'artist.name' => 'Caterwauler McCrae' },
            { join => 'artist' });
 eval { $rs->count };
-like($sql, qr/\QSELECT COUNT( * ) FROM `cd` `me`  JOIN `artist` `artist` ON ( `artist`.`artistid` = `me`.`artist` ) WHERE ( `artist`.`name` = ? AND `me`.`year` = ? )\E/, 'got correct SQL for count query with quoting');
-
+ok (eq_sql
+  (
+    $sql,
+    q/SELECT COUNT( * ) FROM `cd` `me`  JOIN `artist` `artist` ON ( `artist`.`artistid` = `me`.`artist` ) WHERE ( `artist`.`name` = ? AND `me`.`year` = ? )/,
+  ),
+  'got correct SQL for count query with quoting'
+);
 my $order = 'year DESC';
 $rs = $schema->resultset('CD')->search({},
             { 'order_by' => $order });
 eval { $rs->first };
-like($sql, qr/ORDER BY `\Q${order}\E`/, 'quoted ORDER BY with DESC (should use a scalarref anyway)');
+ok (eq_sql
+  (
+    $sql,
+    qq/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY `${order}`/,
+  ),
+  'quoted ORDER BY with DESC (should use a scalarref anyway)'
+);
 
 $rs = $schema->resultset('CD')->search({},
             { 'order_by' => \$order });
 eval { $rs->first };
-like($sql, qr/ORDER BY \Q${order}\E/, 'did not quote ORDER BY with scalarref');
+ok (eq_sql
+  (
+    $sql,
+    qq/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY ${order}/,
+  ),
+  'did not quote ORDER BY with scalarref'
+);
 
 $schema->connection(
   $dsn,
@@ -59,14 +74,20 @@
   undef,
   { AutoCommit => 1, quote_char => [qw/[ ]/], name_sep => '.' }
 );
-$schema->storage->debugcb(sub { $sql = $_[1] });
+$schema->storage->debugobj(DBIC::DebugObj->new(\$sql));
 $schema->storage->debug(1);
 
 $rs = $schema->resultset('CD')->search(
            { 'me.year' => 2001, 'artist.name' => 'Caterwauler McCrae' },
            { join => 'artist' });
 eval { $rs->count };
-like($sql, qr/\QSELECT COUNT( * ) FROM [cd] [me]  JOIN [artist] [artist] ON ( [artist].[artistid] = [me].[artist] ) WHERE ( [artist].[name] = ? AND [me].[year] = ? )\E/, 'got correct SQL for count query with bracket quoting');
+ok (eq_sql
+  (
+    $sql,
+    q/SELECT COUNT( * ) FROM [cd] [me]  JOIN [artist] [artist] ON ( [artist].[artistid] = [me].[artist] ) WHERE ( [artist].[name] = ? AND [me].[year] = ? )/,
+  ),
+  'got correct SQL for count query with bracket quoting'
+);
 
 my %data = (
        name => 'Bill',
@@ -81,6 +102,3 @@
 );
 
 is($schema->storage->sql_maker->update('group', \%data), 'UPDATE `group` SET `name` = ?, `order` = ?', 'quoted table names for UPDATE');
-
-$schema->storage->debugcb($orig_debugcb);
-$schema->storage->debug($orig_debug);

Modified: DBIx-Class/0.08/branches/stopgap/t/41orrible.t
===================================================================
--- DBIx-Class/0.08/branches/stopgap/t/41orrible.t	2009-01-29 18:45:46 UTC (rev 5373)
+++ DBIx-Class/0.08/branches/stopgap/t/41orrible.t	2009-01-29 20:00:16 UTC (rev 5374)
@@ -2,34 +2,44 @@
 use warnings;
 
 use Test::More;
-#use DBIx::Class::Storage::DBI;
 use DBIx::Class::Storage::DBI::Oracle::WhereJoins;
 
+use lib qw(t/lib);
+use DBIC::SqlMakerTest;
+
 plan tests => 4;
 
 my $sa = new DBIC::SQL::Abstract::Oracle;
 
 $sa->limit_dialect('RowNum');
 
-is($sa->select('rubbish',
-                  [ 'foo.id', 'bar.id', \'TO_CHAR(foo.womble, "blah")' ],
-                  undef, undef, 1, 3),
-   'SELECT * FROM
-(
-    SELECT A.*, ROWNUM r FROM
-    (
-        SELECT foo.id AS col1, bar.id AS col2, TO_CHAR(foo.womble, "blah") AS col3 FROM rubbish 
-    ) A
-    WHERE ROWNUM < 5
-) B
-WHERE r >= 4
-', 'Munged stuff to make Oracle not explode');
+ok (eq_sql
+  (
+    $sa->select (
+        'rubbish',
+        [ 'foo.id', 'bar.id', \'TO_CHAR(foo.womble, "blah")' ],
+        undef, undef, 1, 3
+    ),
+    q/SELECT * FROM
+        (
+            SELECT A.*, ROWNUM r FROM
+                (
+                    SELECT foo.id AS col1, bar.id AS col2, TO_CHAR(foo.womble, "blah") AS col3 FROM rubbish 
+                ) A
+            WHERE ROWNUM < 5
+        ) B
+        WHERE r >= 4
+    /,
+  ),
+  'Munged stuff to make Oracle not explode'
+);
 
 # test WhereJoins
 # search with undefined or empty $cond
 
 #  my ($self, $table, $fields, $where, $order, @rest) = @_;
-is($sa->select([
+my ($sql, @bind) = $sa->select(
+    [
         { me => "cd" },
         [
             { "-join_type" => "LEFT", artist => "artist" },
@@ -38,10 +48,18 @@
     ],
     [ 'cd.cdid', 'cd.artist', 'cd.title', 'cd.year', 'artist.artistid', 'artist.name' ],
     undef,
-    undef),
-   'SELECT cd.cdid, cd.artist, cd.title, cd.year, artist.artistid, artist.name FROM cd me, artist artist WHERE ( artist.artistid(+) = me.artist )', 'WhereJoins search with empty where clause');
+    undef
+);
 
-is($sa->select([
+is_same_sql_bind (
+    $sql, \@bind,
+    'SELECT cd.cdid, cd.artist, cd.title, cd.year, artist.artistid, artist.name FROM cd me, artist artist WHERE ( artist.artistid(+) = me.artist )',
+    [],
+    'WhereJoins search with empty where clause',
+);
+
+($sql, @bind) = $sa->select(
+    [
         { me => "cd" },
         [
             { "-join_type" => "", artist => "artist" },
@@ -50,10 +68,18 @@
     ],
     [ 'cd.cdid', 'cd.artist', 'cd.title', 'cd.year', 'artist.artistid', 'artist.name' ],
     { 'artist.artistid' => 3 },
-    undef),
-   'SELECT cd.cdid, cd.artist, cd.title, cd.year, artist.artistid, artist.name FROM cd me, artist artist WHERE ( ( ( artist.artistid = me.artist ) AND ( artist.artistid = ? ) ) )', 'WhereJoins search with where clause');
+    undef
+);
 
-is($sa->select([
+is_same_sql_bind (
+    $sql, \@bind,
+    'SELECT cd.cdid, cd.artist, cd.title, cd.year, artist.artistid, artist.name FROM cd me, artist artist WHERE ( ( ( artist.artistid = me.artist ) AND ( artist.artistid = ? ) ) )',
+    [ 3 ],
+    'WhereJoins search with where clause'
+);
+
+($sql, @bind) = $sa->select(
+    [
         { me => "cd" },
         [
             { "-join_type" => "LEFT", artist => "artist" },
@@ -62,7 +88,12 @@
     ],
     [ 'cd.cdid', 'cd.artist', 'cd.title', 'cd.year', 'artist.artistid', 'artist.name' ],
     [{ 'artist.artistid' => 3 }, { 'me.cdid' => 5 }],
-    undef),
-   'SELECT cd.cdid, cd.artist, cd.title, cd.year, artist.artistid, artist.name FROM cd me, artist artist WHERE ( ( ( artist.artistid(+) = me.artist ) AND ( ( ( artist.artistid = ? ) OR ( me.cdid = ? ) ) ) ) )', 'WhereJoins search with or in where clause');
+    undef
+);
 
-
+is_same_sql_bind (
+    $sql, \@bind,
+    'SELECT cd.cdid, cd.artist, cd.title, cd.year, artist.artistid, artist.name FROM cd me, artist artist WHERE ( ( ( artist.artistid(+) = me.artist ) AND ( ( ( artist.artistid = ? ) OR ( me.cdid = ? ) ) ) ) )', 
+    [ 3, 5 ],
+    'WhereJoins search with or in where clause'
+);

Modified: DBIx-Class/0.08/branches/stopgap/t/76joins.t
===================================================================
--- DBIx-Class/0.08/branches/stopgap/t/76joins.t	2009-01-29 18:45:46 UTC (rev 5373)
+++ DBIx-Class/0.08/branches/stopgap/t/76joins.t	2009-01-29 20:00:16 UTC (rev 5374)
@@ -5,6 +5,7 @@
 use lib qw(t/lib);
 use DBICTest;
 use Data::Dumper;
+use DBIC::SqlMakerTest;
 
 my $schema = DBICTest->init_schema();
 
@@ -43,7 +44,13 @@
           . 'child.father_id ) JOIN person mother ON ( mother.person_id '
           . '= child.mother_id )'
           ;
-is( $sa->_recurse_from(@j), $match, 'join 1 ok' );
+ok (eq_sql
+  (
+    $sa->_recurse_from(@j),
+    $match,
+  ),
+  'join 1 ok'
+);
 
 my @j2 = (
     { mother => 'person' },
@@ -59,8 +66,15 @@
        . ' father.person_id = child.father_id )) ON ( mother.person_id = '
        . 'child.mother_id )'
        ;
-is( $sa->_recurse_from(@j2), $match, 'join 2 ok' );
+ok (eq_sql
+  (
+    $sa->_recurse_from(@j2),
+    $match,
+  ),
+  'join 2 ok'
+);
 
+
 my @j3 = (
     { child => 'person' },
     [ { father => 'person', -join_type => 'inner' }, { 'father.person_id' => 'child.father_id' }, ],
@@ -71,7 +85,13 @@
           . '= child.mother_id )'
           ;
 
-is( $sa->_recurse_from(@j3), $match, 'join 3 (inner join) ok');
+ok (eq_sql
+  (
+    $sa->_recurse_from(@j3),
+    $match,
+  ),
+  'join 3 (inner join) ok'
+);
 
 my @j4 = (
     { mother => 'person' },
@@ -87,7 +107,13 @@
        . ' father.person_id = child.father_id )) ON ( mother.person_id = '
        . 'child.mother_id )'
        ;
-is( $sa->_recurse_from(@j4), $match, 'join 4 (nested joins + join types) ok');
+ok (eq_sql
+  (
+    $sa->_recurse_from(@j4),
+    $match,
+  ),
+  'join 4 (nested joins + join types) ok'
+);
 
 my @j5 = (
     { child => 'person' },
@@ -98,7 +124,13 @@
           . 'child.father_id ) JOIN person mother ON ( mother.person_id '
           . '= child.mother_id )'
           ;
-is( $sa->_recurse_from(@j5), $match, 'join 5 (SCALAR reference for ON statement) ok' );
+ok (eq_sql
+  (
+    $sa->_recurse_from(@j5),
+    $match,
+  ),
+  'join 5 (SCALAR reference for ON statement) ok'
+);
 
 my @j6 = (
     { child => 'person' },

Modified: DBIx-Class/0.08/branches/stopgap/t/91debug.t
===================================================================
--- DBIx-Class/0.08/branches/stopgap/t/91debug.t	2009-01-29 18:45:46 UTC (rev 5373)
+++ DBIx-Class/0.08/branches/stopgap/t/91debug.t	2009-01-29 20:00:16 UTC (rev 5374)
@@ -4,6 +4,8 @@
 use Test::More;
 use lib qw(t/lib);
 use DBICTest;
+use DBIC::SqlMakerTest;
+use DBIC::DebugObj;
 
 my $schema = DBICTest->init_schema();
 
@@ -49,13 +51,15 @@
 
 # test trace output correctness for bind params
 {
-    my $sql = '';
-    $schema->storage->debugcb( sub { $sql = $_[1] } );
+    my ($sql, @bind);
+    $schema->storage->debugobj(DBIC::DebugObj->new(\$sql, \@bind));
+    $schema->storage->debug(1);
 
     my @cds = $schema->resultset('CD')->search( { artist => 1, cdid => { -between => [ 1, 3 ] }, } );
-    like(
-        $sql,
-        qr/\QSELECT me.cdid, me.artist, me.title, me.year FROM cd me WHERE ( artist = ? AND cdid BETWEEN ? AND ? ): '1', '1', '3'\E/,
+    is_same_sql_bind (
+        $sql, \@bind,
+        q/SELECT me.cdid, me.artist, me.title, me.year FROM cd me WHERE ( artist = ? AND cdid BETWEEN ? AND ? )/,
+        [qw/'1' '1' '3'/],
         'got correct SQL with all bind parameters'
     );
 }

Modified: DBIx-Class/0.08/branches/stopgap/t/95sql_maker_quote.t
===================================================================
--- DBIx-Class/0.08/branches/stopgap/t/95sql_maker_quote.t	2009-01-29 18:45:46 UTC (rev 5373)
+++ DBIx-Class/0.08/branches/stopgap/t/95sql_maker_quote.t	2009-01-29 20:00:16 UTC (rev 5374)
@@ -3,6 +3,8 @@
 
 use Test::More;
 
+use lib qw(t/lib);
+use DBIC::SqlMakerTest;
 
 BEGIN {
     eval "use DBD::SQLite";
@@ -11,8 +13,6 @@
         : ( tests => 8 );
 }
 
-use lib qw(t/lib);
-
 use_ok('DBICTest');
 
 my $schema = DBICTest->init_schema();
@@ -22,7 +22,7 @@
 $sql_maker->quote_char('`');
 $sql_maker->name_sep('.');
 
-my ($sql,) = $sql_maker->select(
+my ($sql, @bind) = $sql_maker->select(
           [
             {
               'me' => 'cd'
@@ -51,11 +51,15 @@
           undef
 );
 
-is($sql, 
-   q/SELECT COUNT( * ) FROM `cd` `me`  JOIN `artist` `artist` ON ( `artist`.`artistid` = `me`.`artist` ) WHERE ( `artist`.`name` = ? AND `me`.`year` = ? )/, 
-   'got correct SQL for count query with quoting');
+is_same_sql_bind(
+   $sql, \@bind,
+   q/SELECT COUNT( * ) FROM `cd` `me`  JOIN `artist` `artist` ON ( `artist`.`artistid` = `me`.`artist` ) WHERE ( `artist`.`name` = ? AND `me`.`year` = ? )/,
+   [ ['artist.name' => 'Caterwauler McCrae'], ['me.year' => 2001] ],
+   'got correct SQL and bind parameters for count query with quoting'
+);
 
-($sql,) = $sql_maker->select(
+
+($sql, @bind) = $sql_maker->select(
           [
             {
               'me' => 'cd'
@@ -78,15 +82,17 @@
 TODO: {
     local $TODO = "order_by with quoting needs fixing (ash/castaway)";
 
-    is($sql, 
-       q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY `year` DESC/, 
-       'quoted ORDER BY with DESC okay');
+    is_same_sql_bind(
+        $sql, \@bind,
+        q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY `year DESC`/, [],
+        'scalar ORDER BY okay (single value)'
+    );
 }
 
 TODO: {
     local $TODO = "select attr with star needs fixing (mst/nate)";
 
-    ($sql,) = $sql_maker->select(
+    ($sql, @bind) = $sql_maker->select(
           [
             {
               'me' => 'cd'
@@ -98,13 +104,17 @@
           undef,
           [],
           undef,
-          undef    
+          undef
     );
 
-    is($sql, q/SELECT `me`.* FROM `cd` `me`/, 'select attr with me.* is right');
+    is_same_sql_bind(
+      $sql, \@bind,
+      q/SELECT `me`.* FROM `cd` `me`/, [],
+      'select attr with me.* is right'
+    );
 }
 
-($sql,) = $sql_maker->select(
+($sql, @bind) = $sql_maker->select(
           [
             {
               'me' => 'cd'
@@ -124,18 +134,14 @@
           undef
 );
 
-is($sql, 
-   q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY year DESC/,
-   'did not quote ORDER BY with scalarref');
-
-my %data = ( 
-    name => 'Bill',
-    order => 12
+is_same_sql_bind(
+  $sql, \@bind,
+  q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY year DESC/, [],
+  'did not quote ORDER BY with scalarref'
 );
 
-my @binds;
 
-($sql, at binds) = $sql_maker->update(
+($sql, @bind) = $sql_maker->update(
           'group',
           {
             'order' => '12',
@@ -143,13 +149,15 @@
           }
 );
 
-is($sql,
-   q/UPDATE `group` SET `name` = ?, `order` = ?/,
-   'quoted table names for UPDATE');
+is_same_sql_bind(
+  $sql, \@bind,
+  q/UPDATE `group` SET `name` = ?, `order` = ?/, [ ['name' => 'Bill'], ['order' => '12'] ],
+  'quoted table names for UPDATE'
+);
 
 $sql_maker->quote_char([qw/[ ]/]);
 
-($sql,) = $sql_maker->select(
+($sql, @bind) = $sql_maker->select(
           [
             {
               'me' => 'cd'
@@ -178,12 +186,14 @@
           undef
 );
 
-is($sql,
-   q/SELECT COUNT( * ) FROM [cd] [me]  JOIN [artist] [artist] ON ( [artist].[artistid] = [me].[artist] ) WHERE ( [artist].[name] = ? AND [me].[year] = ? )/,
-   'got correct SQL for count query with bracket quoting');
+is_same_sql_bind(
+  $sql, \@bind,
+  q/SELECT COUNT( * ) FROM [cd] [me]  JOIN [artist] [artist] ON ( [artist].[artistid] = [me].[artist] ) WHERE ( [artist].[name] = ? AND [me].[year] = ? )/, [ ['artist.name' => 'Caterwauler McCrae'], ['me.year' => 2001] ],
+  'got correct SQL and bind parameters for count query with bracket quoting'
+);
 
 
-($sql, at binds) = $sql_maker->update(
+($sql, @bind) = $sql_maker->update(
           'group',
           {
             'order' => '12',
@@ -191,6 +201,8 @@
           }
 );
 
-is($sql,
-   q/UPDATE [group] SET [name] = ?, [order] = ?/,
-   'bracket quoted table names for UPDATE');
+is_same_sql_bind(
+  $sql, \@bind,
+  q/UPDATE [group] SET [name] = ?, [order] = ?/, [ ['name' => 'Bill'], ['order' => '12'] ],
+  'bracket quoted table names for UPDATE'
+);




More information about the Bast-commits mailing list