removed parentheses from argument lists in docs
[dbsrgits/DBIx-Class.git] / t / 19quotes.t
CommitLineData
2a816814 1use strict;
2use Test::More;
3use IO::File;
4
5BEGIN {
6 eval "use DBD::SQLite";
7 plan $@
8 ? ( skip_all => 'needs DBD::SQLite for testing' )
e535069e 9 : ( tests => 6 );
2a816814 10}
11
12use lib qw(t/lib);
13
14use_ok('DBICTest');
15
22b15c96 16use_ok('DBICTest::HelperRels');
17
2437a1e3 18DBICTest->schema->storage->sql_maker->quote_char("'");
19DBICTest->schema->storage->sql_maker->name_sep('.');
2a816814 20
21my $rs = DBICTest::CD->search(
54540863 22 { 'me.year' => 2001, 'artist.name' => 'Caterwauler McCrae' },
2a816814 23 { join => 'artist' });
24
25cmp_ok( $rs->count, '==', 1, "join with fields quoted");
26
e535069e 27$rs = DBICTest::CD->search({},
28 { 'order_by' => 'year DESC'});
29{
30 my $warnings;
31 local $SIG{__WARN__} = sub { $warnings .= $_[0] };
32 my $first = eval{ $rs->first() };
33 ok( $warnings =~ /ORDER BY terms/, "Problem with ORDER BY quotes" );
34}
35
36my $order = 'year DESC';
37$rs = DBICTest::CD->search({},
38 { 'order_by' => \$order });
39{
40 my $warnings;
41 local $SIG{__WARN__} = sub { $warnings .= $_[0] };
42 my $first = $rs->first();
43 ok( $warnings !~ /ORDER BY terms/,
44 "No problem handling ORDER by scalaref" );
45}
46
2437a1e3 47DBICTest->schema->storage->sql_maker->quote_char([qw/[ ]/]);
48DBICTest->schema->storage->sql_maker->name_sep('.');
49
50$rs = DBICTest::CD->search(
51 { 'me.year' => 2001, 'artist.name' => 'Caterwauler McCrae' },
52 { join => 'artist' });
53cmp_ok($rs->count,'==', 1,"join quoted with brackets.");
54
55
56
57