rename fetch_all_hash to fetch_hash_all (not backword...
...compatible)
... | ... |
@@ -1,3 +1,7 @@ |
1 |
+0.0301 |
|
2 |
+ rename fetch_all_hash to fetch_hash_all (not backword compatible) |
|
3 |
+ rename fetch_rows_hash to fetch_hash_rows (not backword compatible) |
|
4 |
+ rename fetch_first_hash to fetch_hash_first (not backword compatible) |
|
1 | 5 |
0.0202 |
2 | 6 |
add build requires 'DBI' |
3 | 7 |
0.0201 |
... | ... |
@@ -1,10 +1,11 @@ |
1 | 1 |
package DBIx::Custom::Result; |
2 | 2 |
use Object::Simple; |
3 |
- |
|
4 |
-our $VERSION = '0.0202'; |
|
5 |
- |
|
3 |
+use strict; |
|
4 |
+use warnings; |
|
6 | 5 |
use Carp 'croak'; |
7 | 6 |
|
7 |
+our $VERSION = '0.0301'; |
|
8 |
+ |
|
8 | 9 |
# Attributes |
9 | 10 |
sub sth : Attr {} |
10 | 11 |
sub fetch_filter : Attr {} |
... | ... |
@@ -98,7 +99,7 @@ sub fetch_first { |
98 | 99 |
} |
99 | 100 |
|
100 | 101 |
# Fetch only first (hash) |
101 |
-sub fetch_first_hash { |
|
102 |
+sub fetch_hash_first { |
|
102 | 103 |
my $self = shift; |
103 | 104 |
|
104 | 105 |
# Fetch hash |
... | ... |
@@ -136,7 +137,7 @@ sub fetch_rows { |
136 | 137 |
} |
137 | 138 |
|
138 | 139 |
# Fetch multi rows (hash) |
139 |
-sub fetch_rows_hash { |
|
140 |
+sub fetch_hash_rows { |
|
140 | 141 |
my ($self, $count) = @_; |
141 | 142 |
|
142 | 143 |
# Not specified Row count |
... | ... |
@@ -170,7 +171,7 @@ sub fetch_all { |
170 | 171 |
} |
171 | 172 |
|
172 | 173 |
# Fetch all (hash) |
173 |
-sub fetch_all_hash { |
|
174 |
+sub fetch_hash_all { |
|
174 | 175 |
my $self = shift; |
175 | 176 |
|
176 | 177 |
my $rows = []; |
... | ... |
@@ -198,7 +199,7 @@ DBIx::Custom::Result - Resultset for DBIx::Custom |
198 | 199 |
|
199 | 200 |
=head1 VERSION |
200 | 201 |
|
201 |
-Version 0.0202 |
|
202 |
+Version 0.0301 |
|
202 | 203 |
|
203 | 204 |
=head1 SYNOPSIS |
204 | 205 |
|
... | ... |
@@ -284,13 +285,13 @@ fetch_hash method is fetch resultset and get row as hash or hash reference. |
284 | 285 |
|
285 | 286 |
This method fetch only first and finish statement handle |
286 | 287 |
|
287 |
-=head2 fetch_first_hash |
|
288 |
+=head2 fetch_hash_first |
|
288 | 289 |
|
289 | 290 |
# Fetch only first as hash (Scalar context) |
290 |
- $row = $result->fetch_first_hash; |
|
291 |
+ $row = $result->fetch_hash_first; |
|
291 | 292 |
|
292 | 293 |
# Fetch only first as hash (Scalar context) |
293 |
- @row = $result->fetch_first_hash; |
|
294 |
+ @row = $result->fetch_hash_first; |
|
294 | 295 |
|
295 | 296 |
This method fetch only first and finish statement handle |
296 | 297 |
|
... | ... |
@@ -305,16 +306,16 @@ This method fetch only first and finish statement handle |
305 | 306 |
# Sapmle |
306 | 307 |
$rows = $result->fetch_rows(10); |
307 | 308 |
|
308 |
-=head2 fetch_rows_hash |
|
309 |
+=head2 fetch_hash_rows |
|
309 | 310 |
|
310 | 311 |
# Fetch multi rows as hash (Scalar context) |
311 |
- $rows = $result->fetch_rows_hash($row_count); |
|
312 |
+ $rows = $result->fetch_hash_rows($row_count); |
|
312 | 313 |
|
313 | 314 |
# Fetch multi rows as hash (List context) |
314 |
- @rows = $result->fetch_rows_hash($row_count); |
|
315 |
+ @rows = $result->fetch_hash_rows($row_count); |
|
315 | 316 |
|
316 | 317 |
# Sapmle |
317 |
- $rows = $result->fetch_rows_hash(10); |
|
318 |
+ $rows = $result->fetch_hash_rows(10); |
|
318 | 319 |
|
319 | 320 |
=head2 fetch_all |
320 | 321 |
|
... | ... |
@@ -331,16 +332,16 @@ This method fetch only first and finish statement handle |
331 | 332 |
|
332 | 333 |
fetch_all method is fetch resultset and get all rows as array or array reference. |
333 | 334 |
|
334 |
-=head2 fetch_all_hash |
|
335 |
+=head2 fetch_hash_all |
|
335 | 336 |
|
336 | 337 |
# Fetch all row as array ref of hash ref (Scalar context) |
337 |
- $rows = $result->fetch_all_hash; |
|
338 |
+ $rows = $result->fetch_hash_all; |
|
338 | 339 |
|
339 | 340 |
# Fetch all row as array of hash ref (List context) |
340 | 341 |
@rows = $result->fecth_all_hash; |
341 | 342 |
|
342 | 343 |
# Sample |
343 |
- my $rows = $result->fetch_all_hash; |
|
344 |
+ my $rows = $result->fetch_hash_all; |
|
344 | 345 |
my $val0_key1 = $rows->[0]{key1}; |
345 | 346 |
my $val1_key2 = $rows->[1]{key2}; |
346 | 347 |
|
... | ... |
@@ -95,17 +95,17 @@ is_deeply([@row], [1, 2], "$test : row"); |
95 | 95 |
ok(!@row, "$test : finished"); |
96 | 96 |
|
97 | 97 |
|
98 |
-test 'fetch_first_hash'; |
|
98 |
+test 'fetch_hash_first'; |
|
99 | 99 |
$result = query($dbh, $sql); |
100 |
-$row = $result->fetch_first_hash; |
|
100 |
+$row = $result->fetch_hash_first; |
|
101 | 101 |
is_deeply($row, {key1 => 1, key2 => 2}, "$test : row"); |
102 | 102 |
$row = $result->fetch_hash; |
103 | 103 |
ok(!$row, "$test : finished"); |
104 | 104 |
|
105 | 105 |
|
106 |
-test 'fetch_first_hash list context'; |
|
106 |
+test 'fetch_hash_first list context'; |
|
107 | 107 |
$result = query($dbh, $sql); |
108 |
-@row = $result->fetch_first_hash; |
|
108 |
+@row = $result->fetch_hash_first; |
|
109 | 109 |
is_deeply({@row}, {key1 => 1, key2 => 2}, "$test : row"); |
110 | 110 |
@row = $result->fetch_hash; |
111 | 111 |
ok(!@row, "$test : finished"); |
... | ... |
@@ -148,38 +148,38 @@ eval {$result->fetch_rows}; |
148 | 148 |
like($@, qr/Row count must be specified/, "$test : Not specified row count"); |
149 | 149 |
|
150 | 150 |
|
151 |
-test 'fetch_rows_hash'; |
|
151 |
+test 'fetch_hash_rows'; |
|
152 | 152 |
$result = query($dbh, $sql); |
153 |
-$rows = $result->fetch_rows_hash(2); |
|
153 |
+$rows = $result->fetch_hash_rows(2); |
|
154 | 154 |
is_deeply($rows, [{key1 => 1, key2 => 2}, |
155 | 155 |
{key1 => 3, key2 => 4}], "$test : fetch_rows first"); |
156 |
-$rows = $result->fetch_rows_hash(2); |
|
156 |
+$rows = $result->fetch_hash_rows(2); |
|
157 | 157 |
is_deeply($rows, [{key1 => 5, key2 => 6}, |
158 | 158 |
{key1 => 7, key2 => 8}], "$test : fetch_rows secound"); |
159 |
-$rows = $result->fetch_rows_hash(2); |
|
159 |
+$rows = $result->fetch_hash_rows(2); |
|
160 | 160 |
is_deeply($rows, [{key1 => 9, key2 => 10}], "$test : fetch_rows third"); |
161 |
-$rows = $result->fetch_rows_hash(2); |
|
161 |
+$rows = $result->fetch_hash_rows(2); |
|
162 | 162 |
ok(!$rows); |
163 | 163 |
|
164 | 164 |
|
165 | 165 |
test 'fetch_rows list context'; |
166 | 166 |
$result = query($dbh, $sql); |
167 |
-@rows = $result->fetch_rows_hash(2); |
|
167 |
+@rows = $result->fetch_hash_rows(2); |
|
168 | 168 |
is_deeply([@rows], [{key1 => 1, key2 => 2}, |
169 | 169 |
{key1 => 3, key2 => 4}], "$test : fetch_rows first"); |
170 |
-@rows = $result->fetch_rows_hash(2); |
|
170 |
+@rows = $result->fetch_hash_rows(2); |
|
171 | 171 |
is_deeply([@rows], [{key1 => 5, key2 => 6}, |
172 | 172 |
{key1 => 7, key2 => 8}], "$test : fetch_rows secound"); |
173 |
-@rows = $result->fetch_rows_hash(2); |
|
173 |
+@rows = $result->fetch_hash_rows(2); |
|
174 | 174 |
is_deeply([@rows], [{key1 => 9, key2 => 10}], "$test : fetch_rows third"); |
175 |
-@rows = $result->fetch_rows_hash(2); |
|
175 |
+@rows = $result->fetch_hash_rows(2); |
|
176 | 176 |
ok(!@rows); |
177 | 177 |
$dbh->do("delete from table1 where key1 = 5 or key1 = 7 or key1 = 9"); |
178 | 178 |
|
179 | 179 |
|
180 | 180 |
test 'fetch_rows error'; |
181 | 181 |
$result = query($dbh, $sql); |
182 |
-eval {$result->fetch_rows_hash}; |
|
182 |
+eval {$result->fetch_hash_rows}; |
|
183 | 183 |
like($@, qr/Row count must be specified/, "$test : Not specified row count"); |
184 | 184 |
|
185 | 185 |
|
... | ... |
@@ -194,13 +194,13 @@ $result = query($dbh, $sql); |
194 | 194 |
is_deeply(\@rows, [[1, 2], [3, 4]], $test); |
195 | 195 |
|
196 | 196 |
|
197 |
-test 'fetch_all_hash'; |
|
197 |
+test 'fetch_hash_all'; |
|
198 | 198 |
$result = query($dbh, $sql); |
199 |
-@rows = $result->fetch_all_hash; |
|
199 |
+@rows = $result->fetch_hash_all; |
|
200 | 200 |
is_deeply($rows, [[1, 2], [3, 4]], $test); |
201 | 201 |
|
202 | 202 |
|
203 |
-test 'fetch_all_hash list context'; |
|
203 |
+test 'fetch_hash_all list context'; |
|
204 | 204 |
$result = query($dbh, $sql); |
205 | 205 |
@rows = $result->fetch_all; |
206 | 206 |
is_deeply(\@rows, [[1, 2], [3, 4]], $test); |
... | ... |
@@ -222,7 +222,7 @@ is_deeply($rows, [[3, 2], [3, 4]], "$test array"); |
222 | 222 |
|
223 | 223 |
$result = query($dbh, $sql); |
224 | 224 |
$result->fetch_filter($fetch_filter); |
225 |
-$rows = $result->fetch_all_hash; |
|
225 |
+$rows = $result->fetch_hash_all; |
|
226 | 226 |
is_deeply($rows, [{key1 => 3, key2 => 2}, {key1 => 3, key2 => 4}], "$test hash"); |
227 | 227 |
|
228 | 228 |
$result = query($dbh, $sql); |
... | ... |
@@ -232,7 +232,7 @@ is_deeply($rows, [[1, 2], [3, 4]], "$test array no filter keys"); |
232 | 232 |
|
233 | 233 |
$result = query($dbh, $sql); |
234 | 234 |
$result->no_fetch_filters(['key1']); |
235 |
-$rows = $result->fetch_all_hash; |
|
235 |
+$rows = $result->fetch_hash_all; |
|
236 | 236 |
is_deeply($rows, [{key1 => 1, key2 => 2}, {key1 => 3, key2 => 4}], "$test hash no filter keys"); |
237 | 237 |
|
238 | 238 |
|
... | ... |
@@ -1,3 +1,5 @@ |
1 |
+0.0201 |
|
2 |
+ catch up DBIx::Custom::Result version up |
|
1 | 3 |
0.0102 |
2 | 4 |
update document |
3 | 5 |
0.0101 |
... | ... |
@@ -5,7 +5,7 @@ use warnings; |
5 | 5 |
use strict; |
6 | 6 |
use Carp 'croak'; |
7 | 7 |
|
8 |
-our $VERSION = '0.0102'; |
|
8 |
+our $VERSION = '0.0201'; |
|
9 | 9 |
|
10 | 10 |
my $class = __PACKAGE__; |
11 | 11 |
|
... | ... |
@@ -59,7 +59,7 @@ DBIx::Custom::SQLite - DBIx::Custom SQLite implementation |
59 | 59 |
|
60 | 60 |
=head1 Version |
61 | 61 |
|
62 |
-Version 0.0102 |
|
62 |
+Version 0.0201 |
|
63 | 63 |
|
64 | 64 |
=head1 Synopsys |
65 | 65 |
|
... | ... |
@@ -32,7 +32,7 @@ $ret_val = $dbi->do($CREATE_TABLE->{0}); |
32 | 32 |
ok(defined $ret_val, $test); |
33 | 33 |
$dbi->utf8_filter_on; |
34 | 34 |
$dbi->insert('table1', {key1 => 'あ', key2 => 2}); |
35 |
-$rows = $dbi->select('table1', {key1 => 'あ'})->fetch_all_hash; |
|
35 |
+$rows = $dbi->select('table1', {key1 => 'あ'})->fetch_hash_all; |
|
36 | 36 |
is_deeply($rows, [{key1 => 'あ', key2 => 2}], "$test : select rows"); |
37 | 37 |
|
38 | 38 |
test 'connect_memory error'; |
... | ... |
@@ -1,3 +1,5 @@ |
1 |
+0.0401 |
|
2 |
+ catch up with DBIx::Custom::Result version up |
|
1 | 3 |
0.0301 |
2 | 4 |
exchange filter argument 'key', 'value' (not backword compatible) |
3 | 5 |
0.0201 |
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
package DBIx::Custom; |
2 | 2 |
use Object::Simple; |
3 | 3 |
|
4 |
-our $VERSION = '0.0301'; |
|
4 |
+our $VERSION = '0.0401'; |
|
5 | 5 |
|
6 | 6 |
use Carp 'croak'; |
7 | 7 |
use DBI; |
... | ... |
@@ -736,7 +736,7 @@ DBIx::Custom - Customizable simple DBI |
736 | 736 |
|
737 | 737 |
=head1 VERSION |
738 | 738 |
|
739 |
-Version 0.0301 |
|
739 |
+Version 0.0401 |
|
740 | 740 |
|
741 | 741 |
=head1 CAUTION |
742 | 742 |
|
... | ... |
@@ -139,12 +139,12 @@ $result = $dbi->execute($query); |
139 | 139 |
is_deeply(\@rows, [[1, 2], [3, 4]], "$test : fetch_all list context"); |
140 | 140 |
|
141 | 141 |
$result = $dbi->execute($query); |
142 |
-@rows = $result->fetch_all_hash; |
|
143 |
-is_deeply($rows, [[1, 2], [3, 4]], "$test : fetch_all_hash scalar context"); |
|
142 |
+@rows = $result->fetch_hash_all; |
|
143 |
+is_deeply($rows, [[1, 2], [3, 4]], "$test : fetch_hash_all scalar context"); |
|
144 | 144 |
|
145 | 145 |
$result = $dbi->execute($query); |
146 | 146 |
@rows = $result->fetch_all; |
147 |
-is_deeply(\@rows, [[1, 2], [3, 4]], "$test : fetch_all_hash list context"); |
|
147 |
+is_deeply(\@rows, [[1, 2], [3, 4]], "$test : fetch_hash_all list context"); |
|
148 | 148 |
|
149 | 149 |
|
150 | 150 |
test 'Insert query return value'; |
... | ... |
@@ -171,7 +171,7 @@ $dbi->execute($insert_tmpl, {key1 => 1, key2 => 2}, sub { |
171 | 171 |
}); |
172 | 172 |
}); |
173 | 173 |
$result = $dbi->execute($SELECT_TMPL->{0}); |
174 |
-$rows = $result->fetch_all_hash; |
|
174 |
+$rows = $result->fetch_hash_all; |
|
175 | 175 |
is_deeply($rows, [{key1 => 1, key2 => 3}], $test); |
176 | 176 |
|
177 | 177 |
|
... | ... |
@@ -198,7 +198,7 @@ $select_query->fetch_filter(sub { |
198 | 198 |
return $value; |
199 | 199 |
}); |
200 | 200 |
$result = $dbi->execute($select_query); |
201 |
-$rows = $result->fetch_all_hash; |
|
201 |
+$rows = $result->fetch_hash_all; |
|
202 | 202 |
is_deeply($rows, [{key1 => 2, key2 => 6}], "$test : bind_filter fetch_filter"); |
203 | 203 |
|
204 | 204 |
$dbi->do("delete from table1;"); |
... | ... |
@@ -206,7 +206,7 @@ $insert_query->no_bind_filters('key1'); |
206 | 206 |
$select_query->no_fetch_filters('key2'); |
207 | 207 |
$dbi->execute($insert_query, {key1 => 1, key2 => 2}); |
208 | 208 |
$result = $dbi->execute($select_query); |
209 |
-$rows = $result->fetch_all_hash; |
|
209 |
+$rows = $result->fetch_hash_all; |
|
210 | 210 |
is_deeply($rows, [{key1 => 1, key2 => 2}], "$test : no_fetch_filters no_bind_filters"); |
211 | 211 |
|
212 | 212 |
$dbi->do($DROP_TABLE->{0}); |
... | ... |
@@ -223,7 +223,7 @@ $insert_query->bind_filter(sub { |
223 | 223 |
$dbi->execute($insert_query, {table1 => {key1 => 1, key2 => 2}}); |
224 | 224 |
$select_query = $dbi->create_query($SELECT_TMPL->{0}); |
225 | 225 |
$result = $dbi->execute($select_query); |
226 |
-$rows = $result->fetch_all_hash; |
|
226 |
+$rows = $result->fetch_hash_all; |
|
227 | 227 |
is_deeply($rows, [{key1 => 3, key2 => 2}], "$test : insert with table name"); |
228 | 228 |
|
229 | 229 |
test 'Filter in'; |
... | ... |
@@ -240,7 +240,7 @@ $select_query->bind_filter(sub { |
240 | 240 |
return $value; |
241 | 241 |
}); |
242 | 242 |
$result = $dbi->execute($select_query, {table1 => {key1 => [1,5], key2 => [2,5]}}); |
243 |
-$rows = $result->fetch_all_hash; |
|
243 |
+$rows = $result->fetch_hash_all; |
|
244 | 244 |
is_deeply($rows, [{key1 => 2, key2 => 4}], "$test : bind_filter"); |
245 | 245 |
|
246 | 246 |
|
... | ... |
@@ -254,37 +254,37 @@ $sth->execute(6, 7, 8, 9, 10); |
254 | 254 |
$tmpl = "select * from table1 where {= key1} and {<> key2} and {< key3} and {> key4} and {>= key5};"; |
255 | 255 |
$query = $dbi->create_query($tmpl); |
256 | 256 |
$result = $dbi->execute($query, {key1 => 1, key2 => 3, key3 => 4, key4 => 3, key5 => 5}); |
257 |
-$rows = $result->fetch_all_hash; |
|
257 |
+$rows = $result->fetch_hash_all; |
|
258 | 258 |
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : basic tag1"); |
259 | 259 |
|
260 | 260 |
$tmpl = "select * from table1 where {= table1.key1} and {<> table1.key2} and {< table1.key3} and {> table1.key4} and {>= table1.key5};"; |
261 | 261 |
$query = $dbi->create_query($tmpl); |
262 | 262 |
$result = $dbi->execute($query, {table1 => {key1 => 1, key2 => 3, key3 => 4, key4 => 3, key5 => 5}}); |
263 |
-$rows = $result->fetch_all_hash; |
|
263 |
+$rows = $result->fetch_hash_all; |
|
264 | 264 |
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : basic tag1 with table"); |
265 | 265 |
|
266 | 266 |
$tmpl = "select * from table1 where {= table1.key1} and {<> table1.key2} and {< table1.key3} and {> table1.key4} and {>= table1.key5};"; |
267 | 267 |
$query = $dbi->create_query($tmpl); |
268 | 268 |
$result = $dbi->execute($query, {'table1.key1' => 1, 'table1.key2' => 3, 'table1.key3' => 4, 'table1.key4' => 3, 'table1.key5' => 5}); |
269 |
-$rows = $result->fetch_all_hash; |
|
269 |
+$rows = $result->fetch_hash_all; |
|
270 | 270 |
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : basic tag1 with table dot"); |
271 | 271 |
|
272 | 272 |
$tmpl = "select * from table1 where {<= key1} and {like key2};"; |
273 | 273 |
$query = $dbi->create_query($tmpl); |
274 | 274 |
$result = $dbi->execute($query, {key1 => 1, key2 => '%2%'}); |
275 |
-$rows = $result->fetch_all_hash; |
|
275 |
+$rows = $result->fetch_hash_all; |
|
276 | 276 |
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : basic tag2"); |
277 | 277 |
|
278 | 278 |
$tmpl = "select * from table1 where {<= table1.key1} and {like table1.key2};"; |
279 | 279 |
$query = $dbi->create_query($tmpl); |
280 | 280 |
$result = $dbi->execute($query, {table1 => {key1 => 1, key2 => '%2%'}}); |
281 |
-$rows = $result->fetch_all_hash; |
|
281 |
+$rows = $result->fetch_hash_all; |
|
282 | 282 |
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : basic tag2 with table"); |
283 | 283 |
|
284 | 284 |
$tmpl = "select * from table1 where {<= table1.key1} and {like table1.key2};"; |
285 | 285 |
$query = $dbi->create_query($tmpl); |
286 | 286 |
$result = $dbi->execute($query, {'table1.key1' => 1, 'table1.key2' => '%2%'}); |
287 |
-$rows = $result->fetch_all_hash; |
|
287 |
+$rows = $result->fetch_hash_all; |
|
288 | 288 |
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : basic tag2 with table dot"); |
289 | 289 |
|
290 | 290 |
|
... | ... |
@@ -298,19 +298,19 @@ $sth->execute(6, 7, 8, 9, 10); |
298 | 298 |
$tmpl = "select * from table1 where {in key1 2};"; |
299 | 299 |
$query = $dbi->create_query($tmpl); |
300 | 300 |
$result = $dbi->execute($query, {key1 => [9, 1]}); |
301 |
-$rows = $result->fetch_all_hash; |
|
301 |
+$rows = $result->fetch_hash_all; |
|
302 | 302 |
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : basic"); |
303 | 303 |
|
304 | 304 |
$tmpl = "select * from table1 where {in table1.key1 2};"; |
305 | 305 |
$query = $dbi->create_query($tmpl); |
306 | 306 |
$result = $dbi->execute($query, {table1 => {key1 => [9, 1]}}); |
307 |
-$rows = $result->fetch_all_hash; |
|
307 |
+$rows = $result->fetch_hash_all; |
|
308 | 308 |
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : with table"); |
309 | 309 |
|
310 | 310 |
$tmpl = "select * from table1 where {in table1.key1 2};"; |
311 | 311 |
$query = $dbi->create_query($tmpl); |
312 | 312 |
$result = $dbi->execute($query, {'table1.key1' => [9, 1]}); |
313 |
-$rows = $result->fetch_all_hash; |
|
313 |
+$rows = $result->fetch_hash_all; |
|
314 | 314 |
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : with table dot"); |
315 | 315 |
|
316 | 316 |
|
... | ... |
@@ -320,39 +320,39 @@ $insert_tmpl = 'insert into table1 {insert key1 key2 key3 key4 key5}'; |
320 | 320 |
$dbi->execute($insert_tmpl, {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}); |
321 | 321 |
|
322 | 322 |
$result = $dbi->execute($SELECT_TMPL->{0}); |
323 |
-$rows = $result->fetch_all_hash; |
|
323 |
+$rows = $result->fetch_hash_all; |
|
324 | 324 |
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : basic"); |
325 | 325 |
|
326 | 326 |
$dbi->do("delete from table1"); |
327 | 327 |
$dbi->execute($insert_tmpl, {'#insert' => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}}); |
328 | 328 |
$result = $dbi->execute($SELECT_TMPL->{0}); |
329 |
-$rows = $result->fetch_all_hash; |
|
329 |
+$rows = $result->fetch_hash_all; |
|
330 | 330 |
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : #insert"); |
331 | 331 |
|
332 | 332 |
$dbi->do("delete from table1"); |
333 | 333 |
$insert_tmpl = 'insert into table1 {insert table1.key1 table1.key2 table1.key3 table1.key4 table1.key5}'; |
334 | 334 |
$dbi->execute($insert_tmpl, {table1 => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}}); |
335 | 335 |
$result = $dbi->execute($SELECT_TMPL->{0}); |
336 |
-$rows = $result->fetch_all_hash; |
|
336 |
+$rows = $result->fetch_hash_all; |
|
337 | 337 |
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : with table name"); |
338 | 338 |
|
339 | 339 |
$dbi->do("delete from table1"); |
340 | 340 |
$insert_tmpl = 'insert into table1 {insert table1.key1 table1.key2 table1.key3 table1.key4 table1.key5}'; |
341 | 341 |
$dbi->execute($insert_tmpl, {'table1.key1' => 1, 'table1.key2' => 2, 'table1.key3' => 3, 'table1.key4' => 4, 'table1.key5' => 5}); |
342 | 342 |
$result = $dbi->execute($SELECT_TMPL->{0}); |
343 |
-$rows = $result->fetch_all_hash; |
|
343 |
+$rows = $result->fetch_hash_all; |
|
344 | 344 |
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : with table name dot"); |
345 | 345 |
|
346 | 346 |
$dbi->do("delete from table1"); |
347 | 347 |
$dbi->execute($insert_tmpl, {'#insert' => {table1 => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}}}); |
348 | 348 |
$result = $dbi->execute($SELECT_TMPL->{0}); |
349 |
-$rows = $result->fetch_all_hash; |
|
349 |
+$rows = $result->fetch_hash_all; |
|
350 | 350 |
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : #insert with table name"); |
351 | 351 |
|
352 | 352 |
$dbi->do("delete from table1"); |
353 | 353 |
$dbi->execute($insert_tmpl, {'#insert' => {'table1.key1' => 1, 'table1.key2' => 2, 'table1.key3' => 3, 'table1.key4' => 4, 'table1.key5' => 5}}); |
354 | 354 |
$result = $dbi->execute($SELECT_TMPL->{0}); |
355 |
-$rows = $result->fetch_all_hash; |
|
355 |
+$rows = $result->fetch_hash_all; |
|
356 | 356 |
is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "$test : #insert with table name dot"); |
357 | 357 |
|
358 | 358 |
|
... | ... |
@@ -366,39 +366,39 @@ $update_tmpl = 'update table1 {update key1 key2 key3 key4} where {= key5}'; |
366 | 366 |
$dbi->execute($update_tmpl, {key1 => 1, key2 => 1, key3 => 1, key4 => 1, key5 => 5}); |
367 | 367 |
|
368 | 368 |
$result = $dbi->execute($SELECT_TMPL->{0}); |
369 |
-$rows = $result->fetch_all_hash; |
|
369 |
+$rows = $result->fetch_hash_all; |
|
370 | 370 |
is_deeply($rows, [{key1 => 1, key2 => 1, key3 => 1, key4 => 1, key5 => 5}, |
371 | 371 |
{key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10}], "$test : basic"); |
372 | 372 |
|
373 | 373 |
$dbi->execute($update_tmpl, {'#update' => {key1 => 2, key2 => 2, key3 => 2, key4 => 2}, key5 => 5}); |
374 | 374 |
$result = $dbi->execute($SELECT_TMPL->{0}); |
375 |
-$rows = $result->fetch_all_hash; |
|
375 |
+$rows = $result->fetch_hash_all; |
|
376 | 376 |
is_deeply($rows, [{key1 => 2, key2 => 2, key3 => 2, key4 => 2, key5 => 5}, |
377 | 377 |
{key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10}], "$test : #update"); |
378 | 378 |
|
379 | 379 |
$update_tmpl = 'update table1 {update table1.key1 table1.key2 table1.key3 table1.key4} where {= table1.key5}'; |
380 | 380 |
$dbi->execute($update_tmpl, {table1 => {key1 => 3, key2 => 3, key3 => 3, key4 => 3, key5 => 5}}); |
381 | 381 |
$result = $dbi->execute($SELECT_TMPL->{0}); |
382 |
-$rows = $result->fetch_all_hash; |
|
382 |
+$rows = $result->fetch_hash_all; |
|
383 | 383 |
is_deeply($rows, [{key1 => 3, key2 => 3, key3 => 3, key4 => 3, key5 => 5}, |
384 | 384 |
{key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10}], "$test : with table name"); |
385 | 385 |
|
386 | 386 |
$update_tmpl = 'update table1 {update table1.key1 table1.key2 table1.key3 table1.key4} where {= table1.key5}'; |
387 | 387 |
$dbi->execute($update_tmpl, {'table1.key1' => 4, 'table1.key2' => 4, 'table1.key3' => 4, 'table1.key4' => 4, 'table1.key5' => 5}); |
388 | 388 |
$result = $dbi->execute($SELECT_TMPL->{0}); |
389 |
-$rows = $result->fetch_all_hash; |
|
389 |
+$rows = $result->fetch_hash_all; |
|
390 | 390 |
is_deeply($rows, [{key1 => 4, key2 => 4, key3 => 4, key4 => 4, key5 => 5}, |
391 | 391 |
{key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10}], "$test : with table name dot"); |
392 | 392 |
|
393 | 393 |
$dbi->execute($update_tmpl, {'#update' => {table1 => {key1 => 5, key2 => 5, key3 => 5, key4 => 5}}, table1 => {key5 => 5}}); |
394 | 394 |
$result = $dbi->execute($SELECT_TMPL->{0}); |
395 |
-$rows = $result->fetch_all_hash; |
|
395 |
+$rows = $result->fetch_hash_all; |
|
396 | 396 |
is_deeply($rows, [{key1 => 5, key2 => 5, key3 => 5, key4 => 5, key5 => 5}, |
397 | 397 |
{key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10}], "$test : update tag #update with table name"); |
398 | 398 |
|
399 | 399 |
$dbi->execute($update_tmpl, {'#update' => {'table1.key1' => 6, 'table1.key2' => 6, 'table1.key3' => 6, 'table1.key4' => 6}, 'table1.key5' => 5}); |
400 | 400 |
$result = $dbi->execute($SELECT_TMPL->{0}); |
401 |
-$rows = $result->fetch_all_hash; |
|
401 |
+$rows = $result->fetch_hash_all; |
|
402 | 402 |
is_deeply($rows, [{key1 => 6, key2 => 6, key3 => 6, key4 => 6, key5 => 5}, |
403 | 403 |
{key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10}], "$test : update tag #update with table name dot"); |
404 | 404 |
|
... | ... |
@@ -412,7 +412,7 @@ $dbi->run_transaction(sub { |
412 | 412 |
$dbi->execute($insert_tmpl, {key1 => 3, key2 => 4}); |
413 | 413 |
}); |
414 | 414 |
$result = $dbi->execute($SELECT_TMPL->{0}); |
415 |
-$rows = $result->fetch_all_hash; |
|
415 |
+$rows = $result->fetch_hash_all; |
|
416 | 416 |
is_deeply($rows, [{key1 => 1, key2 => 2}, {key1 => 3, key2 => 4}], "$test : commit"); |
417 | 417 |
|
418 | 418 |
$dbi->do($DROP_TABLE->{0}); |
... | ... |
@@ -429,7 +429,7 @@ eval{ |
429 | 429 |
like($@, qr/Fatal Error.*Rollback is success/ms, "$test : Rollback success message"); |
430 | 430 |
ok(!$dbi->dbh->{RaiseError}, "$test : restore RaiseError value"); |
431 | 431 |
$result = $dbi->execute($SELECT_TMPL->{0}); |
432 |
-$rows = $result->fetch_all_hash; |
|
432 |
+$rows = $result->fetch_hash_all; |
|
433 | 433 |
is_deeply($rows, [], "$test : rollback"); |
434 | 434 |
|
435 | 435 |
|
... | ... |
@@ -477,7 +477,7 @@ $dbi->do($CREATE_TABLE->{0}); |
477 | 477 |
$dbi->insert('table1', {key1 => 1, key2 => 2}); |
478 | 478 |
$dbi->insert('table1', {key1 => 3, key2 => 4}); |
479 | 479 |
$result = $dbi->execute($SELECT_TMPL->{0}); |
480 |
-$rows = $result->fetch_all_hash; |
|
480 |
+$rows = $result->fetch_hash_all; |
|
481 | 481 |
is_deeply($rows, [{key1 => 1, key2 => 2}, {key1 => 3, key2 => 4}], "$test : basic"); |
482 | 482 |
|
483 | 483 |
$dbi->do('delete from table1'); |
... | ... |
@@ -492,7 +492,7 @@ $dbi->insert('table1', {key1 => 1, key2 => 2}, sub { |
492 | 492 |
}); |
493 | 493 |
}); |
494 | 494 |
$result = $dbi->execute($SELECT_TMPL->{0}); |
495 |
-$rows = $result->fetch_all_hash; |
|
495 |
+$rows = $result->fetch_hash_all; |
|
496 | 496 |
is_deeply($rows, [{key1 => 3, key2 => 2}], "$test : edit_query_callback"); |
497 | 497 |
|
498 | 498 |
|
... | ... |
@@ -511,7 +511,7 @@ $dbi->insert('table1', {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}); |
511 | 511 |
$dbi->insert('table1', {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10}); |
512 | 512 |
$dbi->update('table1', {key2 => 11}, {key1 => 1}); |
513 | 513 |
$result = $dbi->execute($SELECT_TMPL->{0}); |
514 |
-$rows = $result->fetch_all_hash; |
|
514 |
+$rows = $result->fetch_hash_all; |
|
515 | 515 |
is_deeply($rows, [{key1 => 1, key2 => 11, key3 => 3, key4 => 4, key5 => 5}, |
516 | 516 |
{key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10}], |
517 | 517 |
"$test : basic"); |
... | ... |
@@ -521,7 +521,7 @@ $dbi->insert('table1', {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}); |
521 | 521 |
$dbi->insert('table1', {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10}); |
522 | 522 |
$dbi->update('table1', {key2 => 12}, {key2 => 2, key3 => 3}); |
523 | 523 |
$result = $dbi->execute($SELECT_TMPL->{0}); |
524 |
-$rows = $result->fetch_all_hash; |
|
524 |
+$rows = $result->fetch_hash_all; |
|
525 | 525 |
is_deeply($rows, [{key1 => 1, key2 => 12, key3 => 3, key4 => 4, key5 => 5}, |
526 | 526 |
{key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10}], |
527 | 527 |
"$test : update key same as search key"); |
... | ... |
@@ -540,7 +540,7 @@ $dbi->update('table1', {key2 => 11}, {key1 => 1}, sub { |
540 | 540 |
}); |
541 | 541 |
}); |
542 | 542 |
$result = $dbi->execute($SELECT_TMPL->{0}); |
543 |
-$rows = $result->fetch_all_hash; |
|
543 |
+$rows = $result->fetch_hash_all; |
|
544 | 544 |
is_deeply($rows, [{key1 => 1, key2 => 22, key3 => 3, key4 => 4, key5 => 5}, |
545 | 545 |
{key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10}], |
546 | 546 |
"$test : query edit callback"); |
... | ... |
@@ -575,7 +575,7 @@ $dbi->update_all('table1', {key2 => 10}, sub { |
575 | 575 |
}) |
576 | 576 |
}); |
577 | 577 |
$result = $dbi->execute($SELECT_TMPL->{0}); |
578 |
-$rows = $result->fetch_all_hash; |
|
578 |
+$rows = $result->fetch_hash_all; |
|
579 | 579 |
is_deeply($rows, [{key1 => 1, key2 => 20, key3 => 3, key4 => 4, key5 => 5}, |
580 | 580 |
{key1 => 6, key2 => 20, key3 => 8, key4 => 9, key5 => 10}], |
581 | 581 |
"$test : query edit callback"); |
... | ... |
@@ -588,7 +588,7 @@ $dbi->insert('table1', {key1 => 1, key2 => 2}); |
588 | 588 |
$dbi->insert('table1', {key1 => 3, key2 => 4}); |
589 | 589 |
$dbi->delete('table1', {key1 => 1}); |
590 | 590 |
$result = $dbi->execute($SELECT_TMPL->{0}); |
591 |
-$rows = $result->fetch_all_hash; |
|
591 |
+$rows = $result->fetch_hash_all; |
|
592 | 592 |
is_deeply($rows, [{key1 => 3, key2 => 4}], "$test : basic"); |
593 | 593 |
|
594 | 594 |
$dbi->do("delete from table1;"); |
... | ... |
@@ -602,14 +602,14 @@ $dbi->delete('table1', {key2 => 1}, sub { |
602 | 602 |
}); |
603 | 603 |
}); |
604 | 604 |
$result = $dbi->execute($SELECT_TMPL->{0}); |
605 |
-$rows = $result->fetch_all_hash; |
|
605 |
+$rows = $result->fetch_hash_all; |
|
606 | 606 |
is_deeply($rows, [{key1 => 3, key2 => 4}], "$test : query edit callback"); |
607 | 607 |
|
608 | 608 |
$dbi->delete_all('table1'); |
609 | 609 |
$dbi->insert('table1', {key1 => 1, key2 => 2}); |
610 | 610 |
$dbi->insert('table1', {key1 => 3, key2 => 4}); |
611 | 611 |
$dbi->delete('table1', {key1 => 1, key2 => 2}); |
612 |
-$rows = $dbi->select('table1')->fetch_all_hash; |
|
612 |
+$rows = $dbi->select('table1')->fetch_hash_all; |
|
613 | 613 |
is_deeply($rows, [{key1 => 3, key2 => 4}], "$test : delete multi key"); |
614 | 614 |
|
615 | 615 |
|
... | ... |
@@ -632,7 +632,7 @@ $dbi->insert('table1', {key1 => 1, key2 => 2}); |
632 | 632 |
$dbi->insert('table1', {key1 => 3, key2 => 4}); |
633 | 633 |
$dbi->delete_all('table1'); |
634 | 634 |
$result = $dbi->execute($SELECT_TMPL->{0}); |
635 |
-$rows = $result->fetch_all_hash; |
|
635 |
+$rows = $result->fetch_hash_all; |
|
636 | 636 |
is_deeply($rows, [], "$test : basic"); |
637 | 637 |
|
638 | 638 |
|
... | ... |
@@ -641,20 +641,20 @@ $dbi = DBIx::Custom->new($NEW_ARGS->{0}); |
641 | 641 |
$dbi->do($CREATE_TABLE->{0}); |
642 | 642 |
$dbi->insert('table1', {key1 => 1, key2 => 2}); |
643 | 643 |
$dbi->insert('table1', {key1 => 3, key2 => 4}); |
644 |
-$rows = $dbi->select('table1')->fetch_all_hash; |
|
644 |
+$rows = $dbi->select('table1')->fetch_hash_all; |
|
645 | 645 |
is_deeply($rows, [{key1 => 1, key2 => 2}, |
646 | 646 |
{key1 => 3, key2 => 4}], "$test : table"); |
647 | 647 |
|
648 |
-$rows = $dbi->select('table1', ['key1'])->fetch_all_hash; |
|
648 |
+$rows = $dbi->select('table1', ['key1'])->fetch_hash_all; |
|
649 | 649 |
is_deeply($rows, [{key1 => 1}, {key1 => 3}], "$test : table and columns and where key"); |
650 | 650 |
|
651 |
-$rows = $dbi->select('table1', {key1 => 1})->fetch_all_hash; |
|
651 |
+$rows = $dbi->select('table1', {key1 => 1})->fetch_hash_all; |
|
652 | 652 |
is_deeply($rows, [{key1 => 1, key2 => 2}], "$test : table and columns and where key"); |
653 | 653 |
|
654 |
-$rows = $dbi->select('table1', ['key1'], {key1 => 3})->fetch_all_hash; |
|
654 |
+$rows = $dbi->select('table1', ['key1'], {key1 => 3})->fetch_hash_all; |
|
655 | 655 |
is_deeply($rows, [{key1 => 3}], "$test : table and columns and where key"); |
656 | 656 |
|
657 |
-$rows = $dbi->select('table1', "order by key1 desc limit 1")->fetch_all_hash; |
|
657 |
+$rows = $dbi->select('table1', "order by key1 desc limit 1")->fetch_hash_all; |
|
658 | 658 |
is_deeply($rows, [{key1 => 3, key2 => 4}], "$test : append statement"); |
659 | 659 |
|
660 | 660 |
$rows = $dbi->select('table1', {key1 => 2}, sub { |
... | ... |
@@ -666,7 +666,7 @@ $rows = $dbi->select('table1', {key1 => 2}, sub { |
666 | 666 |
} |
667 | 667 |
return $value; |
668 | 668 |
}); |
669 |
-})->fetch_all_hash; |
|
669 |
+})->fetch_hash_all; |
|
670 | 670 |
is_deeply($rows, [{key1 => 1, key2 => 2}], "$test : query edit call back"); |
671 | 671 |
|
672 | 672 |
$dbi->do($CREATE_TABLE->{2}); |
... | ... |
@@ -674,7 +674,7 @@ $dbi->insert('table2', {key1 => 1, key3 => 5}); |
674 | 674 |
$rows = $dbi->select([qw/table1 table2/], |
675 | 675 |
['table1.key1 as table1_key1', 'table2.key1 as table2_key1', 'key2', 'key3'], |
676 | 676 |
{'table1.key2' => 2}, |
677 |
- "where table1.key1 = table2.key1")->fetch_all_hash; |
|
677 |
+ "where table1.key1 = table2.key1")->fetch_hash_all; |
|
678 | 678 |
is_deeply($rows, [{table1_key1 => 1, table2_key1 => 1, key2 => 2, key3 => 5}], "$test : join"); |
679 | 679 |
|
680 | 680 |
test 'Cache'; |