7 use SQL::Abstract::Test import => [qw/is_same_sql_bind/];
11 my $sql_maker = SQL::Abstract->new(
13 name_sep => $q ? '.' : '',
17 $sql_maker->where({ foo => { -ident => undef } })
18 } qr/-ident requires a single plain scalar argument/;
21 local $sql_maker->{disable_old_special_ops} = 1;
22 $sql_maker->where({'-or' => [{'-ident' => 'foo'},'foo']})
23 } qr/Illegal.*top-level/;
26 local $sql_maker->{disable_old_special_ops} = 1;
27 $sql_maker->where({'-or' => [{'-ident' => 'foo'},{'=' => \'bozz'}]})
28 } qr/Illegal.*top-level/;
30 my ($sql, @bind) = $sql_maker->select('artist', '*', { 'artist.name' => { -ident => 'artist.pseudonym' } } );
36 WHERE ${q}artist${q}.${q}name${q} = ${q}artist${q}.${q}pseudonym${q}
41 ($sql, @bind) = $sql_maker->update('artist',
42 { 'artist.name' => { -ident => 'artist.pseudonym' } },
43 { 'artist.name' => { '!=' => { -ident => 'artist.pseudonym' } } },
48 "UPDATE ${q}artist${q}
49 SET ${q}artist${q}.${q}name${q} = ${q}artist${q}.${q}pseudonym${q}
50 WHERE ${q}artist${q}.${q}name${q} != ${q}artist${q}.${q}pseudonym${q}
55 ($sql) = $sql_maker->select(
56 \(my $from = 'foo JOIN bar ON foo.bar_id = bar.id'),
57 [ { -ident => [ 'foo', 'name' ] }, { -ident => [ 'bar', '*' ] } ]
63 "SELECT ${q}foo${q}.${q}name${q}, ${q}bar${q}.*