... | ... |
@@ -597,18 +597,11 @@ This filter is executed after C<type_rule> filter. |
597 | 597 |
|
598 | 598 |
=head2 C<flat> |
599 | 599 |
|
600 |
- my $flat = $result->flat; |
|
600 |
+ my @list = $result->flat; |
|
601 | 601 |
|
602 |
-All value is flatten and added to one array reference. |
|
602 |
+All values is added to flatten list. |
|
603 | 603 |
|
604 |
- my @flat = $dbi->select(['id', 'title'])->flat; |
|
605 |
- |
|
606 |
-If C<fetch_all> method return the following data |
|
607 |
- |
|
608 |
- [ |
|
609 |
- [1, 'Perl'], |
|
610 |
- [2, 'Ruby'] |
|
611 |
- ] |
|
604 |
+ my @list = $dbi->select(['id', 'title'])->flat; |
|
612 | 605 |
|
613 | 606 |
C<flat> method return the following data. |
614 | 607 |
|
... | ... |
@@ -758,7 +751,11 @@ By default, type rule is on. |
758 | 751 |
|
759 | 752 |
Get first column's first value. |
760 | 753 |
|
761 |
- my $count = $dbi->select('count(*)')->value; |
|
754 |
+ my $count = $dbi->select('count(*)', table => 'book')->value; |
|
755 |
+ |
|
756 |
+This is almost same as the following one. |
|
757 |
+ |
|
758 |
+ my $count = $dbi->select('count(*)')->fetch_one->[0]; |
|
762 | 759 |
|
763 | 760 |
=head2 C<values> |
764 | 761 |
|
... | ... |
@@ -766,6 +763,11 @@ Get first column's first value. |
766 | 763 |
|
767 | 764 |
Get first column's values. |
768 | 765 |
|
769 |
- my $names = $dbi->select('name', table => 'book')->values; |
|
766 |
+ my $tables = $dbi->select('show tables')->values; |
|
767 |
+ |
|
768 |
+This is same as the following one. |
|
769 |
+ |
|
770 |
+ my $rows = $dbi->select('show tables')->fetch_all; |
|
771 |
+ my $tables = [map { $_->[0] } @$rows]; |
|
770 | 772 |
|
771 | 773 |
=cut |