7 use DBICTest ':DiffSQL';
9 my $schema = DBICTest->init_schema( no_deploy => 1 );
12 @{ $schema->storage->_dbi_connect_info },
13 { AutoCommit => 1, quote_char => [qw/[ ]/] }
16 my $rs = $schema->resultset('CD')->search(
17 { 'me.year' => 2001, 'artist.name' => 'Caterwauler McCrae' },
22 [ { dbic_colname => "artist.name", sqlt_datatype => "varchar", sqlt_size => 100 }
23 => 'Caterwauler McCrae' ],
24 [ { dbic_colname => "me.year", sqlt_datatype => "varchar", sqlt_size => 100 }
30 "(SELECT COUNT( * ) FROM cd [me] JOIN [artist] [artist] ON [artist].[artistid] = [me].[artist] WHERE ( [artist].[name] = ? AND [me].[year] = ? ))",
32 'got correct SQL for count query with bracket quoting'
35 $schema->storage->sql_maker->quote_char('`');
36 $schema->storage->sql_maker->name_sep('.');
40 "(SELECT COUNT( * ) FROM cd `me` JOIN `artist` `artist` ON ( `artist`.`artistid` = `me`.`artist` ) WHERE ( `artist`.`name` = ? AND `me`.`year` = ? ))",
42 'got correct SQL for count query with mysql quoting'
45 # !!! talk to ribasushi *explicitly* before modfying these tests !!!
48 $schema->resultset('CD')->search({}, { order_by => 'year DESC', columns => 'cdid' })->as_query,
49 '(SELECT `me`.`cdid` FROM cd `me` ORDER BY `year DESC`)',
51 'quoted ORDER BY with DESC (should use a scalarref anyway)'
55 $schema->resultset('CD')->search({}, { order_by => \'year DESC', columns => 'cdid' })->as_query,
56 '(SELECT `me`.`cdid` FROM cd `me` ORDER BY year DESC)',
58 'did not quote ORDER BY with scalarref',
63 scalar $schema->storage->sql_maker->update('group', { order => 12, name => 'Bill' }),
64 'UPDATE `group` SET `name` = ?, `order` = ?',
65 'quoted table names for UPDATE' );