Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
# Retrieve all the data to process from the database sub _all_data { my $self = shift; my $sql = shift; my $sth = $mssql_dbh->prepare($sql); $sth->execute() || die $sth->errstr; # array indices for each returned row my $rs = $sth->fetchall_arrayref( { id => 1, account_number => 1, box => 1, number => 1, address => 1, type => 1, quantity => 1, count => 1, new_line => 1, date => 1, } ); return $rs; }
This call, I would only need to retrieve 3 rows, but I would like to still use the same sub _all_data(), thats the issue, cause the _all_data() is expecting all the columns and I only need 3 this time.... my $sql = "select id, account_number, box,number,address, type, quant +ity, count, new_line, date from my_table where id <>'' order by date desc"; my $results = $self->_all_data($sql); ...
Thanks for helping!... my $sql = "select id, account_number, date from my_table where id <>'' order by date desc"; my $results = $self->_all_data($sql); ...
|
|---|