| ... | ... |
@@ -68,24 +68,44 @@ $t->new->create_table1->insert({k1 => 1, k2 => 2}, {k1 => 3, k2 => 4})->test(sub
|
| 68 | 68 |
my $r; # resultset |
| 69 | 69 |
my @rows; |
| 70 | 70 |
|
| 71 |
- # Simple query array |
|
| 71 |
+ # Simple query array ref |
|
| 72 | 72 |
$r = $dbi->query("select k1, k2 from t1");
|
| 73 | 73 |
|
| 74 | 74 |
@rows = (); |
| 75 | 75 |
while (my $row = $r->fetch) {
|
| 76 | 76 |
push @rows, [@$row]; |
| 77 | 77 |
} |
| 78 |
+ is_deeply(\@rows, [[1, 2], [3, 4]], 'Simple query array ref'); |
|
| 79 |
+ |
|
| 80 |
+ |
|
| 81 |
+ # Simple query array |
|
| 82 |
+ $r = $dbi->query("select k1, k2 from t1");
|
|
| 83 |
+ |
|
| 84 |
+ @rows = (); |
|
| 85 |
+ while (my @row = $r->fetch) {
|
|
| 86 |
+ push @rows, [@row]; |
|
| 87 |
+ } |
|
| 78 | 88 |
is_deeply(\@rows, [[1, 2], [3, 4]], 'Simple query array'); |
| 79 | 89 |
|
| 80 |
- # Simple query hash |
|
| 90 |
+ |
|
| 91 |
+ # Simple query hash ref |
|
| 81 | 92 |
$r = $dbi->query("select k1, k2 from t1;");
|
| 82 | 93 |
|
| 83 | 94 |
@rows = (); |
| 84 | 95 |
while (my $row = $r->fetch_hash) {
|
| 85 | 96 |
push @rows, {%$row};
|
| 86 | 97 |
} |
| 87 |
- is_deeply(\@rows, [{k1 => 1, k2 => 2}, {k1 => 3, k2 => 4}], 'Simple query array');
|
|
| 98 |
+ is_deeply(\@rows, [{k1 => 1, k2 => 2}, {k1 => 3, k2 => 4}], 'Simple query hash ref');
|
|
| 99 |
+ |
|
| 100 |
+ |
|
| 101 |
+ # Simple query hash |
|
| 102 |
+ $r = $dbi->query("select k1, k2 from t1;");
|
|
| 88 | 103 |
|
| 104 |
+ @rows = (); |
|
| 105 |
+ while (my %row = $r->fetch_hash) {
|
|
| 106 |
+ push @rows, {%row};
|
|
| 107 |
+ } |
|
| 108 |
+ is_deeply(\@rows, [{k1 => 1, k2 => 2}, {k1 => 3, k2 => 4}], 'Simple query hash ref');
|
|
| 89 | 109 |
|
| 90 | 110 |
|
| 91 | 111 |
|