DBIx-Custom / t / 02-sqlite.t /
Newer Older
349 lines | 13.315kb
add test
yuki-kimoto authored on 2009-10-18
1
use Test::More;
2
use strict;
3
use warnings;
4

            
5
BEGIN {
6
    eval { require DBD::SQLite; 1 }
7
        or plan skip_all => 'DBD::SQLite required';
8
    eval { DBD::SQLite->VERSION >= 1 }
9
        or plan skip_all => 'DBD::SQLite >= 1.00 required';
10

            
11
    plan 'no_plan';
12
    use_ok('DBI::Custom');
13
}
14

            
cleanup
yuki-kimoto authored on 2009-10-29
15
# Function for test name
16
my $test;
17
sub test {
18
    $test = shift;
19
}
add test
yuki-kimoto authored on 2009-10-18
20

            
cleanup#
yuki-kimoto authored on 2009-10-30
21
# Varialbes for test
add prepare
yuki-kimoto authored on 2009-10-31
22
our $CREATE_TABLE = {
add tests
yuki-kimoto authored on 2009-10-31
23
    0 => 'create table table1 (key1 char(255), key2 char(255));',
24
    1 => 'create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));'
add prepare
yuki-kimoto authored on 2009-10-31
25
};
26

            
add tests
yuki-kimoto authored on 2009-10-31
27
our $SELECT_TMPL = {
add tests
yuki-kimoto authored on 2009-10-31
28
    0 => 'select * from table1;'
add tests
yuki-kimoto authored on 2009-10-31
29
};
30

            
cleanup
yuki-kimoto authored on 2009-10-29
31
my $dbi;
32
my $sth;
33
my $tmpl;
cleanup#
yuki-kimoto authored on 2009-10-30
34
my $select_tmpl;
35
my $insert_tmpl;
add tests
yuki-kimoto authored on 2009-10-31
36
my $update_tmpl;
cleanup
yuki-kimoto authored on 2009-10-29
37
my $params;
38
my $sql;
39
my $result;
40
my @rows;
41
my $rows;
add tests
yuki-kimoto authored on 2009-10-29
42
my $query;
cleanup#
yuki-kimoto authored on 2009-10-30
43
my $select_query;
44
my $insert_query;
add tests
yuki-kimoto authored on 2009-10-31
45
my $update_query;
add prepare
yuki-kimoto authored on 2009-10-31
46
my $ret_val;
cleanup#
yuki-kimoto authored on 2009-10-30
47

            
cleanup
yuki-kimoto authored on 2009-10-29
48

            
49

            
add tests
yuki-kimoto authored on 2009-10-31
50
test 'Disconnect';
51
$dbi = DBI::Custom->new(data_source => 'dbi:SQLite:dbname=:memory:');
52
$dbi->connect;
53
$dbi->disconnect;
54
ok(!$dbi->dbh, $test);
add tests
yuki-kimoto authored on 2009-10-31
55

            
cleanup
yuki-kimoto authored on 2009-10-29
56
# Prepare table
57
$dbi = DBI::Custom->new(data_source => 'dbi:SQLite:dbname=:memory:');
58
$dbi->connect;
add prepare
yuki-kimoto authored on 2009-10-31
59
$dbi->do($CREATE_TABLE->{0});
60
$sth = $dbi->prepare("insert into table1 (key1, key2) values (?, ?);");
cleanup
yuki-kimoto authored on 2009-10-29
61
$sth->execute(1, 2);
62
$sth->execute(3, 4);
add test
yuki-kimoto authored on 2009-10-18
63

            
add test module
yuki-kimoto authored on 2009-10-19
64

            
add tests
yuki-kimoto authored on 2009-10-29
65
test 'DBI::Custom::Result test';
66
$tmpl = "select key1, key2 from table1";
67
$query = $dbi->create_query($tmpl);
68
$result = $dbi->execute($query);
cleanup
yuki-kimoto authored on 2009-10-29
69

            
70
@rows = ();
71
while (my $row = $result->fetch) {
72
    push @rows, [@$row];
add test module
yuki-kimoto authored on 2009-10-19
73
}
add tests
yuki-kimoto authored on 2009-10-29
74
is_deeply(\@rows, [[1, 2], [3, 4]], "$test : fetch scalar context");
cleanup
yuki-kimoto authored on 2009-10-29
75

            
76

            
add tests
yuki-kimoto authored on 2009-10-29
77
$result = $dbi->execute($query);
cleanup
yuki-kimoto authored on 2009-10-29
78
@rows = ();
79
while (my @row = $result->fetch) {
80
    push @rows, [@row];
add test module
yuki-kimoto authored on 2009-10-19
81
}
add tests
yuki-kimoto authored on 2009-10-29
82
is_deeply(\@rows, [[1, 2], [3, 4]], "$test : fetch list context");
add test module
yuki-kimoto authored on 2009-10-19
83

            
cleanup
yuki-kimoto authored on 2009-10-29
84

            
add tests
yuki-kimoto authored on 2009-10-29
85
$result = $dbi->execute($query);
cleanup
yuki-kimoto authored on 2009-10-29
86
@rows = ();
87
while (my $row = $result->fetch_hash) {
88
    push @rows, {%$row};
add test module
yuki-kimoto authored on 2009-10-19
89
}
add tests
yuki-kimoto authored on 2009-10-29
90
is_deeply(\@rows, [{key1 => 1, key2 => 2}, {key1 => 3, key2 => 4}], "$test : fetch_hash scalar context");
cleanup
yuki-kimoto authored on 2009-10-29
91

            
92

            
add tests
yuki-kimoto authored on 2009-10-29
93
$result = $dbi->execute($query);
cleanup
yuki-kimoto authored on 2009-10-29
94
@rows = ();
95
while (my %row = $result->fetch_hash) {
96
    push @rows, {%row};
add test module
yuki-kimoto authored on 2009-10-19
97
}
add tests
yuki-kimoto authored on 2009-10-29
98
is_deeply(\@rows, [{key1 => 1, key2 => 2}, {key1 => 3, key2 => 4}], "$test : fetch hash list context");
add test module
yuki-kimoto authored on 2009-10-19
99

            
100

            
add tests
yuki-kimoto authored on 2009-10-29
101
$result = $dbi->execute($query);
cleanup
yuki-kimoto authored on 2009-10-29
102
$rows = $result->fetch_all;
add tests
yuki-kimoto authored on 2009-10-29
103
is_deeply($rows, [[1, 2], [3, 4]], "$test : fetch_all scalar context");
cleanup
yuki-kimoto authored on 2009-10-29
104

            
105

            
add tests
yuki-kimoto authored on 2009-10-29
106
$result = $dbi->execute($query);
cleanup
yuki-kimoto authored on 2009-10-29
107
@rows = $result->fetch_all;
add tests
yuki-kimoto authored on 2009-10-29
108
is_deeply(\@rows, [[1, 2], [3, 4]], "$test : fetch_all list context");
cleanup
yuki-kimoto authored on 2009-10-29
109

            
110

            
add tests
yuki-kimoto authored on 2009-10-29
111
$result = $dbi->execute($query);
cleanup
yuki-kimoto authored on 2009-10-29
112
@rows = $result->fetch_all_hash;
add tests
yuki-kimoto authored on 2009-10-29
113
is_deeply($rows, [[1, 2], [3, 4]], "$test : fetch_all_hash scalar context");
cleanup
yuki-kimoto authored on 2009-10-29
114

            
115

            
add tests
yuki-kimoto authored on 2009-10-29
116
$result = $dbi->execute($query);
cleanup
yuki-kimoto authored on 2009-10-29
117
@rows = $result->fetch_all;
add tests
yuki-kimoto authored on 2009-10-29
118
is_deeply(\@rows, [[1, 2], [3, 4]], "$test : fetch_all_hash list context");
cleanup
yuki-kimoto authored on 2009-10-29
119

            
add tests
yuki-kimoto authored on 2009-10-31
120

            
add tests
yuki-kimoto authored on 2009-10-31
121
test 'Insert query return value';
122
$dbi->reconnect;
123
$dbi->do($CREATE_TABLE->{0});
124
$tmpl = "insert into table1 {insert key1 key2}";
125
$query = $dbi->create_query($tmpl);
126
$ret_val = $dbi->execute($query, {key1 => 1, key2 => 2});
127
ok($ret_val, $test);
128

            
add tests
yuki-kimoto authored on 2009-10-31
129

            
130
test 'Direct execute';
131
$dbi->reconnect;
132
$dbi->do($CREATE_TABLE->{0});
133
$insert_tmpl = "insert into table1 {insert key1 key2}";
134
$dbi->execute($insert_tmpl, {key1 => 1, key2 => 2}, sub {
135
    my $query = shift;
136
    $query->bind_filter(sub {
137
        my ($key, $value) = @_;
138
        if ($key eq 'key2') {
139
            return $value + 1;
140
        }
141
        return $value;
142
    });
143
});
144

            
145
$result = $dbi->execute($SELECT_TMPL->{0});
146

            
147
$rows = $result->fetch_all_hash;
148
is_deeply($rows, [{key1 => 1, key2 => 3}], $test);
149

            
150

            
cleanup#
yuki-kimoto authored on 2009-10-30
151
test 'Filter';
152
$dbi->reconnect;
add tests
yuki-kimoto authored on 2009-10-31
153
$dbi->do($CREATE_TABLE->{0});
cleanup#
yuki-kimoto authored on 2009-10-30
154

            
add tests
yuki-kimoto authored on 2009-10-31
155
$insert_tmpl  = "insert into table1 {insert key1 key2};";
add prepare
yuki-kimoto authored on 2009-10-31
156
$insert_query = $dbi->create_query($insert_tmpl);
157
$insert_query->bind_filter(sub {
add tests
yuki-kimoto authored on 2009-10-31
158
    my ($key, $value, $table, $column) = @_;
159
    if ($key eq 'key1' && $table eq '' && $column eq 'key1') {
add prepare
yuki-kimoto authored on 2009-10-31
160
        return $value * 2;
cleanup#
yuki-kimoto authored on 2009-10-30
161
    }
162
    return $value;
163
});
add tests
yuki-kimoto authored on 2009-10-31
164

            
add tests
yuki-kimoto authored on 2009-10-31
165
$dbi->execute($insert_query, {key1 => 1, key2 => 2});
add prepare
yuki-kimoto authored on 2009-10-31
166

            
add tests
yuki-kimoto authored on 2009-10-31
167
$select_query = $dbi->create_query($SELECT_TMPL->{0});
add prepare
yuki-kimoto authored on 2009-10-31
168
$select_query->fetch_filter(sub {
add tests
yuki-kimoto authored on 2009-10-31
169
    my ($key, $value, $type, $sth, $i) = @_;
170
    if ($key eq 'key2' && $type =~ /char/ && $sth->can('execute') && $i == 1) {
add prepare
yuki-kimoto authored on 2009-10-31
171
        return $value * 3;
172
    }
173
    return $value;
174
});
175
$result = $dbi->execute($select_query);
cleanup#
yuki-kimoto authored on 2009-10-30
176

            
add prepare
yuki-kimoto authored on 2009-10-31
177
$rows = $result->fetch_all_hash;
add tests
yuki-kimoto authored on 2009-10-31
178
is_deeply($rows, [{key1 => 2, key2 => 6}], "$test : bind_filter fetch_filter");
cleanup#
yuki-kimoto authored on 2009-10-30
179

            
add tests
yuki-kimoto authored on 2009-10-31
180

            
181
$dbi->do("delete from table1;");
182
$insert_query->no_bind_filters('key1');
183
$select_query->no_fetch_filters('key2');
184

            
185
$dbi->execute($insert_query, {key1 => 1, key2 => 2});
186
$result = $dbi->execute($select_query);
187
$rows = $result->fetch_all_hash;
188
is_deeply($rows, [{key1 => 1, key2 => 2}], 'no_fetch_filters no_bind_filters');
189

            
190

            
add tests
yuki-kimoto authored on 2009-10-31
191
$dbi->reconnect;
192
$dbi->do($CREATE_TABLE->{0});
193
$insert_tmpl  = "insert into table1 {insert table1.key1 table1.key2}";
194

            
195
$insert_query = $dbi->create_query($insert_tmpl);
196
$insert_query->bind_filter(sub {
197
    my ($key, $value, $table, $column) = @_;
198
    if ($key eq 'table1.key1' && $table eq 'table1' && $column eq 'key1') {
199
        return $value * 3;
200
    }
201
    return $value;
202
});
203

            
204
$dbi->execute($insert_query, {table1 => {key1 => 1, key2 => 2}});
205

            
206
$select_query = $dbi->create_query($SELECT_TMPL->{0});
207
$result       = $dbi->execute($select_query);
208
$rows = $result->fetch_all_hash;
209
is_deeply($rows, [{key1 => 3, key2 => 2}], "$test : insert with table name");
210

            
add tests
yuki-kimoto authored on 2009-10-31
211
test 'DBI::Custom::SQL::Template basic tag';
add tests
yuki-kimoto authored on 2009-10-31
212
$dbi->reconnect;
213
$dbi->do($CREATE_TABLE->{1});
214
$sth = $dbi->prepare("insert into table1 (key1, key2, key3, key4, key5) values (?, ?, ?, ?, ?);");
215
$sth->execute(1, 2, 3, 4, 5);
216
$sth->execute(6, 7, 8, 9, 10);
add tests
yuki-kimoto authored on 2009-10-31
217

            
add tests
yuki-kimoto authored on 2009-10-31
218
$tmpl = "select * from table1 where {= key1} and {<> key2} and {< key3} and {> key4} and {>= key5};";
219
$query = $dbi->create_query($tmpl);
220
$result = $dbi->execute($query, {key1 => 1, key2 => 3, key3 => 4, key4 => 3, key5 => 5});
cleanup
yuki-kimoto authored on 2009-10-29
221
$rows = $result->fetch_all_hash;
add tests
yuki-kimoto authored on 2009-10-31
222
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : basic tag1");
cleanup
yuki-kimoto authored on 2009-10-29
223

            
add tests
yuki-kimoto authored on 2009-10-31
224
$tmpl = "select * from table1 where {= table1.key1} and {<> table1.key2} and {< table1.key3} and {> table1.key4} and {>= table1.key5};";
225
$query = $dbi->create_query($tmpl);
226
$result = $dbi->execute($query, {table1 => {key1 => 1, key2 => 3, key3 => 4, key4 => 3, key5 => 5}});
227
$rows = $result->fetch_all_hash;
228
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : basic tag1 with table");
229

            
230
$tmpl = "select * from table1 where {= table1.key1} and {<> table1.key2} and {< table1.key3} and {> table1.key4} and {>= table1.key5};";
231
$query = $dbi->create_query($tmpl);
232
$result = $dbi->execute($query, {'table1.key1' => 1, 'table1.key2' => 3, 'table1.key3' => 4, 'table1.key4' => 3, 'table1.key5' => 5});
233
$rows = $result->fetch_all_hash;
234
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : basic tag1 with table dot");
235

            
add tests
yuki-kimoto authored on 2009-10-31
236
$tmpl = "select * from table1 where {<= key1} and {like key2};";
237
$query = $dbi->create_query($tmpl);
238
$result = $dbi->execute($query, {key1 => 1, key2 => '%2%'});
239
$rows = $result->fetch_all_hash;
240
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : basic tag2");
cleanup
yuki-kimoto authored on 2009-10-29
241

            
add tests
yuki-kimoto authored on 2009-10-31
242
$tmpl = "select * from table1 where {<= table1.key1} and {like table1.key2};";
243
$query = $dbi->create_query($tmpl);
244
$result = $dbi->execute($query, {table1 => {key1 => 1, key2 => '%2%'}});
245
$rows = $result->fetch_all_hash;
246
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : basic tag2 with table");
247

            
248
$tmpl = "select * from table1 where {<= table1.key1} and {like table1.key2};";
249
$query = $dbi->create_query($tmpl);
250
$result = $dbi->execute($query, {'table1.key1' => 1, 'table1.key2' => '%2%'});
251
$rows = $result->fetch_all_hash;
252
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : basic tag2 with table dot");
253

            
254

            
255

            
256
test 'DIB::Custom::SQL::Template';
257

            
cleanup
yuki-kimoto authored on 2009-10-29
258

            
add tests
yuki-kimoto authored on 2009-10-31
259
test 'DBI::Custom::SQL::Template insert tag';
add tests
yuki-kimoto authored on 2009-10-31
260
$dbi->do("delete from table1");
261
$insert_tmpl = 'insert into table1 {insert key1 key2 key3 key4 key5}';
262
$dbi->execute($insert_tmpl, {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
cleanup
yuki-kimoto authored on 2009-10-29
263

            
add tests
yuki-kimoto authored on 2009-10-31
264
$result = $dbi->execute($SELECT_TMPL->{0});
add tests
yuki-kimoto authored on 2009-10-31
265
$rows = $result->fetch_all_hash;
add tests
yuki-kimoto authored on 2009-10-31
266
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : basic");
cleanup
yuki-kimoto authored on 2009-10-29
267

            
add tests
yuki-kimoto authored on 2009-10-31
268
$dbi->do("delete from table1");
269
$dbi->execute($insert_tmpl, {'#insert' => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}});
270
$result = $dbi->execute($SELECT_TMPL->{0});
271
$rows = $result->fetch_all_hash;
add tests
yuki-kimoto authored on 2009-10-31
272
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : #insert");
add tests
yuki-kimoto authored on 2009-10-31
273

            
274

            
275
$dbi->do("delete from table1");
276
$insert_tmpl = 'insert into table1 {insert table1.key1 table1.key2 table1.key3 table1.key4 table1.key5}';
277
$dbi->execute($insert_tmpl, {table1 => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}});
278
$result = $dbi->execute($SELECT_TMPL->{0});
279
$rows = $result->fetch_all_hash;
add tests
yuki-kimoto authored on 2009-10-31
280
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : with table name");
281

            
add tests
yuki-kimoto authored on 2009-10-31
282
$dbi->do("delete from table1");
283
$insert_tmpl = 'insert into table1 {insert table1.key1 table1.key2 table1.key3 table1.key4 table1.key5}';
284
$dbi->execute($insert_tmpl, {'table1.key1' => 1, 'table1.key2' => 2, 'table1.key3' => 3, 'table1.key4' => 4, 'table1.key5' => 5});
285
$result = $dbi->execute($SELECT_TMPL->{0});
286
$rows = $result->fetch_all_hash;
287
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : with table name dot");
add tests
yuki-kimoto authored on 2009-10-31
288

            
289
$dbi->do("delete from table1");
290
$dbi->execute($insert_tmpl, {'#insert' => {table1 => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}}});
291
$result = $dbi->execute($SELECT_TMPL->{0});
292
$rows = $result->fetch_all_hash;
add tests
yuki-kimoto authored on 2009-10-31
293
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : #insert with table name");
add tests
yuki-kimoto authored on 2009-10-31
294

            
add tests
yuki-kimoto authored on 2009-10-31
295
$dbi->do("delete from table1");
296
$dbi->execute($insert_tmpl, {'#insert' => {'table1.key1' => 1, 'table1.key2' => 2, 'table1.key3' => 3, 'table1.key4' => 4, 'table1.key5' => 5}});
297
$result = $dbi->execute($SELECT_TMPL->{0});
298
$rows = $result->fetch_all_hash;
299
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : #insert with table name dot");
300

            
add tests
yuki-kimoto authored on 2009-10-31
301

            
add tests
yuki-kimoto authored on 2009-10-31
302
test 'DBI::Custom::SQL::Template update tag';
add tests
yuki-kimoto authored on 2009-10-31
303
$dbi->do("delete from table1");
304
$insert_tmpl = "insert into table1 {insert key1 key2 key3 key4 key5}";
305
$dbi->execute($insert_tmpl, {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
306
$dbi->execute($insert_tmpl, {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
307

            
308
$update_tmpl = 'update table1 {update key1 key2 key3 key4} where {= key5}';
309
$dbi->execute($update_tmpl, {key1 => 1, key2 => 1, key3 => 1, key4 => 1, key5 => 5});
310

            
311
$result = $dbi->execute($SELECT_TMPL->{0});
312
$rows = $result->fetch_all_hash;
313
is_deeply($rows, [{key1 => 1, key2 => 1, key3 => 1, key4 => 1, key5 => 5},
add tests
yuki-kimoto authored on 2009-10-31
314
                  {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10}], "$test : basic");
add tests
yuki-kimoto authored on 2009-10-31
315

            
add tests
yuki-kimoto authored on 2009-10-31
316
$dbi->execute($update_tmpl, {'#update' => {key1 => 2, key2 => 2, key3 => 2, key4 => 2}, key5 => 5});
add tests
yuki-kimoto authored on 2009-10-31
317
$result = $dbi->execute($SELECT_TMPL->{0});
318
$rows = $result->fetch_all_hash;
add tests
yuki-kimoto authored on 2009-10-31
319
is_deeply($rows, [{key1 => 2, key2 => 2, key3 => 2, key4 => 2, key5 => 5},
320
                  {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10}], "$test : #update");
add tests
yuki-kimoto authored on 2009-10-31
321

            
add tests
yuki-kimoto authored on 2009-10-31
322
$update_tmpl = 'update table1 {update table1.key1 table1.key2 table1.key3 table1.key4} where {= table1.key5}';
323
$dbi->execute($update_tmpl, {table1 => {key1 => 3, key2 => 3, key3 => 3, key4 => 3, key5 => 5}});
add tests
yuki-kimoto authored on 2009-10-31
324
$result = $dbi->execute($SELECT_TMPL->{0});
325
$rows = $result->fetch_all_hash;
add tests
yuki-kimoto authored on 2009-10-31
326
is_deeply($rows, [{key1 => 3, key2 => 3, key3 => 3, key4 => 3, key5 => 5},
327
                  {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10}], "$test : with table name");
add tests
yuki-kimoto authored on 2009-10-31
328

            
add tests
yuki-kimoto authored on 2009-10-31
329
$update_tmpl = 'update table1 {update table1.key1 table1.key2 table1.key3 table1.key4} where {= table1.key5}';
330
$dbi->execute($update_tmpl, {'table1.key1' => 4, 'table1.key2' => 4, 'table1.key3' => 4, 'table1.key4' => 4, 'table1.key5' => 5});
add tests
yuki-kimoto authored on 2009-10-31
331
$result = $dbi->execute($SELECT_TMPL->{0});
332
$rows = $result->fetch_all_hash;
add tests
yuki-kimoto authored on 2009-10-31
333
is_deeply($rows, [{key1 => 4, key2 => 4, key3 => 4, key4 => 4, key5 => 5},
add tests
yuki-kimoto authored on 2009-10-31
334
                  {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10}], "$test : with table name dot");
cleanup
yuki-kimoto authored on 2009-10-29
335

            
add tests
yuki-kimoto authored on 2009-10-31
336
$dbi->execute($update_tmpl, {'#update' => {table1 => {key1 => 5, key2 => 5, key3 => 5, key4 => 5}}, table1 => {key5 => 5}});
337
$result = $dbi->execute($SELECT_TMPL->{0});
338
$rows = $result->fetch_all_hash;
339
is_deeply($rows, [{key1 => 5, key2 => 5, key3 => 5, key4 => 5, key5 => 5},
340
                  {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10}], "$test update tag #update with table name");
cleanup
yuki-kimoto authored on 2009-10-29
341

            
add tests
yuki-kimoto authored on 2009-10-31
342
$dbi->execute($update_tmpl, {'#update' => {'table1.key1' => 6, 'table1.key2' => 6, 'table1.key3' => 6, 'table1.key4' => 6}, 'table1.key5' => 5});
343
$result = $dbi->execute($SELECT_TMPL->{0});
344
$rows = $result->fetch_all_hash;
345
is_deeply($rows, [{key1 => 6, key2 => 6, key3 => 6, key4 => 6, key5 => 5},
346
                  {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10}], "$test update tag #update with table name dot");
add tests
yuki-kimoto authored on 2009-10-19
347

            
add test module
yuki-kimoto authored on 2009-10-19
348

            
add tests
yuki-kimoto authored on 2009-10-31
349