* Disabled stringification of arrayref bind values (used to pass values for PostgreS...
[dbsrgits/DBIx-Class.git] / t / 95sql_maker.t
CommitLineData
e5938571 1use strict;
2use warnings;
3
4use Test::More;
5use SQL::Abstract::Test import => ['is_same_sql_bind'];
6
7
8BEGIN {
9 eval "use DBD::SQLite";
10 plan $@
11 ? ( skip_all => 'needs DBD::SQLite for testing' )
12 : ( tests => 3 );
13}
14
15use lib qw(t/lib);
16
17use_ok('DBICTest');
18
19my $schema = DBICTest->init_schema();
20
21my $sql_maker = $schema->storage->sql_maker;
22
23
24my ($sql, @bind) = $sql_maker->insert(
25 'lottery',
26 {
27 'day' => '2008-11-16',
28 'numbers' => [13, 21, 34, 55, 89]
29 }
30);
31
32is_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
48is_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);