X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F19quotes.t;h=7a85075b03ff51b51ae177061bf118f891ae2730;hb=69edbc524143680cd0450e12c41c53dddcd38b9d;hp=70c8f8ed4c4d33e08afd8630d8f001b4e53a69ab;hpb=2437a1e37464dc79c36dca000fd6b4c439f4c7b2;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/19quotes.t b/t/19quotes.t index 70c8f8e..7a85075 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 => 4 ); + : ( tests => 7 ); } use lib qw(t/lib); @@ -24,6 +24,26 @@ my $rs = DBICTest::CD->search( 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('.'); @@ -32,6 +52,13 @@ $rs = DBICTest::CD->search( { join => 'artist' }); cmp_ok($rs->count,'==', 1,"join quoted with brackets."); +my %data = ( + name => 'Bill', + order => '12' +); +DBICTest->schema->storage->sql_maker->quote_char('`'); +DBICTest->schema->storage->sql_maker->name_sep('.'); +cmp_ok(DBICTest->schema->storage->sql_maker->update('group', \%data), 'eq', 'UPDATE `group` SET `name` = ?, `order` = ?', "quoted table names for UPDATE");