| ... | ... |
@@ -581,9 +581,10 @@ sub delete_all {
|
| 581 | 581 |
} |
| 582 | 582 |
|
| 583 | 583 |
sub _select_usage { return << 'EOS' }
|
| 584 |
-Usage select : |
|
| 584 |
+Your select arguments is wrong. |
|
| 585 |
+select usage: |
|
| 585 | 586 |
$dbi->select( |
| 586 |
- $table, # must be string |
|
| 587 |
+ $table, # must be string or array ref |
|
| 587 | 588 |
[@$columns], # must be array reference. this is optional |
| 588 | 589 |
{%$where_params}, # must be hash reference. this is optional
|
| 589 | 590 |
$append_statement, # must be string. this is optional |
| ... | ... |
@@ -627,3 +627,13 @@ $rows = $result->fetch_all_hash; |
| 627 | 627 |
is_deeply($rows, [], "$test : basic"); |
| 628 | 628 |
|
| 629 | 629 |
|
| 630 |
+test 'select'; |
|
| 631 |
+$dbi = DBI::Custom->new($NEW_ARGS->{0});
|
|
| 632 |
+$dbi->do($CREATE_TABLE->{0});
|
|
| 633 |
+$dbi->insert('table1', {key1 => 1, key2 => 2});
|
|
| 634 |
+$dbi->insert('table1', {key1 => 3, key2 => 4});
|
|
| 635 |
+ |
|
| 636 |
+$rows = $dbi->select('table1')->fetch_hash_all;
|
|
| 637 |
+is_deeply($rows, [{key1 => 1, key2 => 2},
|
|
| 638 |
+ {key1 => 3, key2 => 4}], "$test : table");
|
|
| 639 |
+ |