X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F19quotes.t;h=18588c8393645ff4ea212de44b17e1b6d519e777;hb=7daf649db5e644ea6d26a12f2caba1582bed6224;hp=abc128386c0b0aceae48e5b222cb5f20e26e1c89;hpb=22b15c96c84ddc1aeddddac637ca4c59a6465dcf;p=dbsrgits%2FDBIx-Class.git diff --git a/t/19quotes.t b/t/19quotes.t index abc1283..18588c8 100644 --- a/t/19quotes.t +++ b/t/19quotes.t @@ -6,7 +6,7 @@ BEGIN { eval "use DBD::SQLite"; plan $@ ? ( skip_all => 'needs DBD::SQLite for testing' ) - : ( tests => 3 ); + : ( tests => 6 ); } use lib qw(t/lib); @@ -15,12 +15,43 @@ use_ok('DBICTest'); use_ok('DBICTest::HelperRels'); -DBICTest::_db->storage->sql_maker->{'quote_char'} = q!'!; -DBICTest::_db->storage->sql_maker->{'name_sep'} = '.'; +DBICTest->schema->storage->sql_maker->quote_char("'"); +DBICTest->schema->storage->sql_maker->name_sep('.'); my $rs = DBICTest::CD->search( - { 'year' => 2001, 'artist.name' => 'Caterwauler McCrae' }, + { 'me.year' => 2001, 'artist.name' => 'Caterwauler McCrae' }, { join => 'artist' }); cmp_ok( $rs->count, '==', 1, "join with fields quoted"); +$rs = DBICTest::CD->search({}, + { 'order_by' => 'year DESC'}); +{ + my $warnings; + local $SIG{__WARN__} = sub { $warnings .= $_[0] }; + my $first = eval{ $rs->first() }; + ok( $warnings =~ /ORDER BY terms/, "Problem with ORDER BY quotes" ); +} + +my $order = 'year DESC'; +$rs = DBICTest::CD->search({}, + { 'order_by' => \$order }); +{ + my $warnings; + local $SIG{__WARN__} = sub { $warnings .= $_[0] }; + my $first = $rs->first(); + ok( $warnings !~ /ORDER BY terms/, + "No problem handling ORDER by scalaref" ); +} + +DBICTest->schema->storage->sql_maker->quote_char([qw/[ ]/]); +DBICTest->schema->storage->sql_maker->name_sep('.'); + +$rs = DBICTest::CD->search( + { 'me.year' => 2001, 'artist.name' => 'Caterwauler McCrae' }, + { join => 'artist' }); +cmp_ok($rs->count,'==', 1,"join quoted with brackets."); + + + +