Factor out bindattr resolver and tighten code a bit
[dbsrgits/DBIx-Class.git] / t / sqlmaker / op_value.t
CommitLineData
41519379 1use strict;
2use warnings;
3
4use Test::More;
5
6use lib qw(t/lib);
7use DBIC::SqlMakerTest;
8
9use_ok('DBICTest');
10
11my $schema = DBICTest->init_schema();
12
13my $sql_maker = $schema->storage->sql_maker;
14
15for my $q ('', '"') {
16
17 $sql_maker->quote_char($q);
18
19 is_same_sql_bind (
20 \[ $sql_maker->select ('artist', '*', { arr1 => { -value => [1,2] }, arr2 => { '>', { -value => [3,4] } }, field => [5,6] } ) ],
21 "SELECT *
22 FROM ${q}artist${q}
23 WHERE ${q}arr1${q} = ? AND
24 ${q}arr2${q} > ? AND
25 ( ${q}field${q} = ? OR ${q}field${q} = ? )
26 ",
27 [
28 [ arr1 => [1,2] ],
29 [ arr2 => [3,4] ],
30 [ field => 5 ],
31 [ field => 6 ],
32 ],
33 );
34}
35
36done_testing;