Skip Menu |

This queue is for tickets about the DBI CPAN distribution.

Report information
The Basics
Id: 127170
Status: new
Priority: 0/
Queue: DBI

People
Owner: Nobody in particular
Requestors: KES [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Another example to bind columns
The H.Merijn Brand example to [binds columns](https://metacpan.org/pod/DBI#bind_columns) to the values inside a hash is useful: $sth->bind_columns( \( @row{ @{$sth->{NAME_lc} } } )) but has a weakness: If data already fetched call to ->bind_columns will flush current values. If you want to bind_columns after you have fetched you can use: use feature 'refaliasing'; no warnings "experimental::refaliasing"; while( my $row = $sth->fetchrow_arrayref ) { \(@$data{ $sth->{NAME_lc}->@* }) = \(@$row); } For older perls: use Data::Alias; alias @$data{ $sth->{NAME_lc}->@* } = @$row; This is useful in situations when you have many left joins, but wanna to join your %$data hash to only subset of fetched values.