summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-09-30 04:48:42 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2006-09-30 04:48:42 +0000
commit75b4ecef20ad7d9baaf3e04496fbe0bf1c30b841 (patch)
tree8751cc0cff87850104257b4dce61e2f814f0b94e
parent2030826b9e19594d98bddc823d16dba1e3e4d717 (diff)
added $form->callproc($procname, @args) returns @hashrefs as wrapper for stored procs.
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@169 4979c152-3d1c-0410-bac9-87ea11338e46
-rwxr-xr-xLedgerSMB/Form.pm15
1 files changed, 15 insertions, 0 deletions
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm
index 3b8e79ca..55b563dc 100755
--- a/LedgerSMB/Form.pm
+++ b/LedgerSMB/Form.pm
@@ -507,6 +507,21 @@ sub round_amount {
return $amount;
}
+sub callproc {
+ my $procname = shift @_;
+ my $argstr = "";
+ my @results;
+ for (1 .. $#_){
+ $argstr .= "?, ";
+ }
+ $argstr =~ s/\, $//;
+ $query = "SELECT $procname($argstr)";
+ my $sth = $form->{dbh}->prepare($query);
+ while (my $ref = $sth->fetchrow_hashref(NAME_lc)){
+ push @results, $ref;
+ }
+ @results;
+}
sub parse_template {