7 local $TODO = 'Temporarily todo-ed for dq2eb';
11 use DBIC::SqlMakerTest;
13 my $schema = DBICTest->init_schema(no_deploy => 1);
15 my $sql_maker = $schema->storage->sql_maker;
19 my ($sql, @bind) = $sql_maker->insert(
22 'day' => '2008-11-16',
23 'numbers' => [13, 21, 34, 55, 89]
29 q/INSERT INTO lottery (day, numbers) VALUES (?, ?)/,
30 [ ['day' => '2008-11-16'], ['numbers' => [13, 21, 34, 55, 89]] ],
31 'sql_maker passes arrayrefs in insert'
35 ($sql, @bind) = $sql_maker->update(
38 'day' => '2008-11-16',
39 'numbers' => [13, 21, 34, 55, 89]
45 q/UPDATE lottery SET day = ?, numbers = ?/,
46 [ ['day' => '2008-11-16'], ['numbers' => [13, 21, 34, 55, 89]] ],
47 'sql_maker passes arrayrefs in update'
51 # make sure the cookbook caveat of { $op, \'...' } no longer applies
53 my ($sql, @bind) = $sql_maker->where({
54 last_attempt => \ '< now() - interval "12 hours"',
55 next_attempt => { '<', \ 'now() - interval "12 hours"' },
65 (created <= 1969 OR created > 1984 )
66 AND last_attempt < now() - interval "12 hours"
67 AND next_attempt < now() - interval "12 hours"
73 # Tests base class for => \'FOO' actually generates proper query. for =>
74 # 'READ'|'SHARE' is tested in db-specific subclasses
75 # we have to instantiate base because SQLMaker::SQLite disables _lock_select
77 require DBIx::Class::SQLMaker;
78 my $sa = DBIx::Class::SQLMaker->new;
80 my ($sql, @bind) = $sa->select('foo', '*', {}, { for => 'update' } );
84 'SELECT * FROM foo FOR UPDATE',
90 my ($sql, @bind) = $sa->select('bar', '*', {}, { for => \'baz' } );
94 'SELECT * FROM bar FOR baz',
103 # Make sure the carp/croak override in SQLA works (via SQLMaker)
104 my $file = quotemeta (__FILE__);
106 $schema->resultset ('Artist')->search ({}, { order_by => { -asc => 'stuff', -desc => 'staff' } } )->as_query;
107 }, qr/$file/, 'Exception correctly croak()ed');