first major round of EMS changes. much more to come late tonight.

This commit is contained in:
Matthew Wilson 2006-04-07 00:02:45 +00:00
parent f3404c319a
commit 2c60283ba3
27 changed files with 5196 additions and 33 deletions

View file

@ -199,6 +199,34 @@ sub buildHashRef {
return \%hash;
}
#-------------------------------------------------------------------
=head2 buildArrayRefOfHashRefs ( sql )
Builds an array reference of hash references of data
from a series of rows. Useful for returning many rows at once.
=head3 sql
An SQL query. The query must select at least two columns of data, the first being the key for the hash, the second being the value. If the query selects more than two columns, then the last column will be the value and the remaining columns will be joined together by a colon ":" to form a complex key. If the query selects only one column, then the key and the value will be the same.
=head3 params
An array reference containing values for any placeholder params used in the SQL query.
=cut
sub buildArrayRefOfHashRefs {
my @array;
my $sth = $_[0]->read($_[1],$_[2]);
while (my $data = $sth->hashRef) {
push(@array,$data);
}
$sth->finish;
return \@array;
}
#-------------------------------------------------------------------