We already depend on latest SQLA - remove all references to >= 1.50 - it will only...
[dbsrgits/DBIx-Class.git] / t / 95sql_maker.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5
6 use lib qw(t/lib);
7 use DBIC::SqlMakerTest;
8
9 BEGIN {
10     eval "use DBD::SQLite";
11     plan $@
12         ? ( skip_all => 'needs DBD::SQLite for testing' )
13         : ( tests => 3 );
14 }
15
16 use_ok('DBICTest');
17
18 my $schema = DBICTest->init_schema();
19
20 my $sql_maker = $schema->storage->sql_maker;
21
22
23 {
24   my ($sql, @bind) = $sql_maker->insert(
25             'lottery',
26             {
27               'day' => '2008-11-16',
28               'numbers' => [13, 21, 34, 55, 89]
29             }
30   );
31
32   is_same_sql_bind(
33     $sql, \@bind,
34     q/INSERT INTO lottery (day, numbers) VALUES (?, ?)/,
35       [ ['day' => '2008-11-16'], ['numbers' => [13, 21, 34, 55, 89]] ],
36     'sql_maker passes arrayrefs in insert'
37   );
38
39
40   ($sql, @bind) = $sql_maker->update(
41             'lottery',
42             {
43               'day' => '2008-11-16',
44               'numbers' => [13, 21, 34, 55, 89]
45             }
46   );
47
48   is_same_sql_bind(
49     $sql, \@bind,
50     q/UPDATE lottery SET day = ?, numbers = ?/,
51       [ ['day' => '2008-11-16'], ['numbers' => [13, 21, 34, 55, 89]] ],
52     'sql_maker passes arrayrefs in update'
53   );
54 }