X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F95sql_maker_quote.t;h=a7687f8f461ae372824c25c3046d8c6acb5b7a7c;hb=b6883aee2545ab07808ac04bc8409fc163b62a5c;hp=56a80722de9186cfa2ddb65965ab140ac7e14ca1;hpb=c80207cdf08857a9d96124ec1f58d2a774816f92;p=dbsrgits%2FDBIx-Class.git diff --git a/t/95sql_maker_quote.t b/t/95sql_maker_quote.t index 56a8072..a7687f8 100644 --- a/t/95sql_maker_quote.t +++ b/t/95sql_maker_quote.t @@ -2,8 +2,9 @@ use strict; use warnings; use Test::More; -use SQL::Abstract::Test import => ['is_same_sql_bind']; +use lib qw(t/lib); +use DBIC::SqlMakerTest; BEGIN { eval "use DBD::SQLite"; @@ -12,8 +13,6 @@ BEGIN { : ( tests => 12 ); } -use lib qw(t/lib); - use_ok('DBICTest'); my $schema = DBICTest->init_schema(); @@ -111,58 +110,60 @@ is_same_sql_bind( 'scalar ORDER BY okay (multiple values)' ); +{ + ($sql, @bind) = $sql_maker->select( + [ + { + 'me' => 'cd' + } + ], + [ + 'me.cdid', + 'me.artist', + 'me.title', + 'me.year' + ], + undef, + { -desc => 'year' }, + undef, + undef + ); -($sql, @bind) = $sql_maker->select( - [ - { - 'me' => 'cd' - } - ], - [ - 'me.cdid', - 'me.artist', - 'me.title', - 'me.year' - ], - undef, - { -desc => 'year' }, - undef, - undef -); - -is_same_sql_bind( - $sql, \@bind, - q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY `year` DESC/, [], - 'hashref ORDER BY okay (single value)' -); + is_same_sql_bind( + $sql, \@bind, + q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY `year` DESC/, [], + 'hashref ORDER BY okay (single value)' + ); -($sql, @bind) = $sql_maker->select( - [ - { - 'me' => 'cd' - } - ], - [ - 'me.cdid', - 'me.artist', - 'me.title', - 'me.year' - ], - undef, - [ - { -desc => 'year' }, - { -asc => 'title' } - ], - undef, - undef -); + ($sql, @bind) = $sql_maker->select( + [ + { + 'me' => 'cd' + } + ], + [ + 'me.cdid', + 'me.artist', + 'me.title', + 'me.year' + ], + undef, + [ + { -desc => 'year' }, + { -asc => 'title' } + ], + undef, + undef + ); + + is_same_sql_bind( + $sql, \@bind, + q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY `year` DESC, `title` ASC/, [], + 'hashref ORDER BY okay (multiple values)' + ); -is_same_sql_bind( - $sql, \@bind, - q/SELECT `me`.`cdid`, `me`.`artist`, `me`.`title`, `me`.`year` FROM `cd` `me` ORDER BY `year` DESC, `title` ASC/, [], - 'hashref ORDER BY okay (multiple values)' -); +} ($sql, @bind) = $sql_maker->select( @@ -232,27 +233,28 @@ is_same_sql_bind( 'quoted table names for UPDATE' ); - -($sql, @bind) = $sql_maker->select( - [ - { - 'me' => 'cd' - } - ], - [ - 'me.*' - ], - undef, - [], - undef, - undef -); - -is_same_sql_bind( - $sql, \@bind, - q/SELECT `me`.* FROM `cd` `me`/, [], - 'select attr with me.* is right' -); +{ + ($sql, @bind) = $sql_maker->select( + [ + { + 'me' => 'cd' + } + ], + [ + 'me.*' + ], + undef, + [], + undef, + undef + ); + + is_same_sql_bind( + $sql, \@bind, + q/SELECT `me`.* FROM `cd` `me`/, [], + 'select attr with me.* is right' + ); +} $sql_maker->quote_char([qw/[ ]/]);