File tree 3 files changed +25
-3
lines changed
3 files changed +25
-3
lines changed Original file line number Diff line number Diff line change 1
1
1.647 - 2025-01-17, H.Merijn Brand
2
2
* Spellcheck
3
- * Fix Makefile rules for Changes
3
+ * Fix Makefile rules for Changes (Windows case issue)
4
+ * Another example to bind columns (issue#159)
4
5
5
6
1.646 - 2025-01-11, H.Merijn Brand
6
7
* Remove "experimental" tag from statistics_info () (issue#134)
Original file line number Diff line number Diff line change @@ -6894,11 +6894,28 @@ a hash (thanks to H.Merijn Brand):
6894
6894
6895
6895
$sth->execute;
6896
6896
my %row;
6897
- $sth->bind_columns( \( @row{ @{$sth->{NAME_lc} } } ));
6897
+ $sth->bind_columns ( \( @row{ @{$sth->{NAME_lc} }} ));
6898
6898
while ($sth->fetch) {
6899
6899
print "$row{region}: $row{sales}\n";
6900
6900
}
6901
6901
6902
+ but has a small drawback: If data already fetched call to L</bind_columns>
6903
+ will flush current values. If you want to bind_columns after you have fetched
6904
+ you can use:
6905
+
6906
+ use feature "refaliasing";
6907
+ no warnings "experimental::refaliasing";
6908
+ while (my $row = $sth->fetchrow_arrayref) {
6909
+ \(@$data{ $sth->{NAME_lc}->@* }) = \(@$row);
6910
+ }
6911
+
6912
+ or, with older perl versions:
6913
+
6914
+ use Data::Alias;
6915
+ alias @$data{ $sth->{NAME_lc}->@* } = @$row;
6916
+
6917
+ This is useful in situations when you have many left joins, but wanna to join
6918
+ your %$data hash to only subset of fetched values.
6902
6919
6903
6920
=head3 C<dump_results >
6904
6921
Original file line number Diff line number Diff line change @@ -22,7 +22,11 @@ Spellcheck
22
22
23
23
=item *
24
24
25
- Fix Makefile rules for Changes
25
+ Fix Makefile rules for Changes (Windows case issue)
26
+
27
+ =item *
28
+
29
+ Another example to bind columns (issue#159)
26
30
27
31
=back
28
32
You can’t perform that action at this time.
0 commit comments