[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [169] trunk/LedgerSMB/Form.pm



Revision: 169
          http://svn.sourceforge.net/ledger-smb/?rev=169&view=rev
Author:   einhverfr
Date:     2006-09-29 21:48:42 -0700 (Fri, 29 Sep 2006)

Log Message:
-----------
added $form->callproc($procname, @args) returns @hashrefs as wrapper for stored procs.

Modified Paths:
--------------
    trunk/LedgerSMB/Form.pm

Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm	2006-09-30 04:36:54 UTC (rev 168)
+++ trunk/LedgerSMB/Form.pm	2006-09-30 04:48:42 UTC (rev 169)
@@ -507,6 +507,21 @@
 	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 {
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.