1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
9 use DBICTest ':DiffSQL';
11 my $schema = DBICTest->init_schema( no_deploy => 1 );
14 @{ $schema->storage->_dbi_connect_info },
15 { AutoCommit => 1, quote_char => [qw/[ ]/] }
18 my $rs = $schema->resultset('CD')->search(
19 { 'me.year' => 2001, 'artist.name' => 'Caterwauler McCrae' },
24 [ { dbic_colname => "artist.name", sqlt_datatype => "varchar", sqlt_size => 100 }
25 => 'Caterwauler McCrae' ],
26 [ { dbic_colname => "me.year", sqlt_datatype => "varchar", sqlt_size => 100 }
32 "(SELECT COUNT( * ) FROM cd [me] JOIN [artist] [artist] ON [artist].[artistid] = [me].[artist] WHERE ( [artist].[name] = ? AND [me].[year] = ? ))",
34 'got correct SQL for count query with bracket quoting'
37 $schema->storage->sql_maker->quote_char('`');
38 $schema->storage->sql_maker->name_sep('.');
42 "(SELECT COUNT( * ) FROM cd `me` JOIN `artist` `artist` ON ( `artist`.`artistid` = `me`.`artist` ) WHERE ( `artist`.`name` = ? AND `me`.`year` = ? ))",
44 'got correct SQL for count query with mysql quoting'
47 # !!! talk to ribasushi *explicitly* before modfying these tests !!!
50 $schema->resultset('CD')->search({}, { order_by => 'year DESC', columns => 'cdid' })->as_query,
51 '(SELECT `me`.`cdid` FROM cd `me` ORDER BY `year DESC`)',
53 'quoted ORDER BY with DESC (should use a scalarref anyway)'
57 $schema->resultset('CD')->search({}, { order_by => \'year DESC', columns => 'cdid' })->as_query,
58 '(SELECT `me`.`cdid` FROM cd `me` ORDER BY year DESC)',
60 'did not quote ORDER BY with scalarref',
65 scalar $schema->storage->sql_maker->update('group', { order => 12, name => 'Bill' }),
66 'UPDATE `group` SET `name` = ?, `order` = ?',
67 'quoted table names for UPDATE' );