Update clases test+functionality
[dbsrgits/SQL-Abstract-2.0-ish.git] / t / 202_update.t
1 use strict;
2 use warnings;
3
4 use Test::More tests => 2;
5 use Test::Differences;
6
7 use FindBin;
8 use lib "$FindBin::Bin/lib";
9 use Test::SQL::Abstract::Util qw/
10   mk_name
11   mk_value
12   mk_alias
13   mk_expr
14   :dumper_sort
15 /;
16
17 use_ok('SQL::Abstract') or BAIL_OUT( "$@" );
18
19 my $sqla = SQL::Abstract->create(1);
20
21 is $sqla->dispatch(
22   { -type => 'update',
23     tablespec => mk_name('test'),
24     columns => [
25       mk_name(qw/me id/),
26       mk_name(qw/hostname/),
27     ],
28     values => [
29       mk_expr('+', mk_name(qw/me id/), mk_value(5)),
30       mk_value('localhost'),
31     ]
32   }
33 ), "UPDATE test SET me.id = me.id + ?, hostname = ?",
34    "update clause";