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

SF.net SVN: ledger-smb: [899] trunk



Revision: 899
          http://svn.sourceforge.net/ledger-smb/?rev=899&view=rev
Author:   einhverfr
Date:     2007-03-14 18:11:26 -0700 (Wed, 14 Mar 2007)

Log Message:
-----------
LedgerSMB->callproc() now uses named arguments

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

Modified: trunk/LedgerSMB/DBObject.pm
===================================================================
--- trunk/LedgerSMB/DBObject.pm	2007-03-14 18:09:59 UTC (rev 898)
+++ trunk/LedgerSMB/DBObject.pm	2007-03-15 01:11:26 UTC (rev 899)
@@ -99,7 +99,7 @@
 	else {
 		@call_args = @_;
 	}
-	$self->callproc($funcname, @call_args);
+	$self->callproc(procname => $funcname, args => ..hidden..);
 }
 
 sub run_custom_queries {

Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm	2007-03-14 18:09:59 UTC (rev 898)
+++ trunk/LedgerSMB.pm	2007-03-15 01:11:26 UTC (rev 899)
@@ -103,10 +103,6 @@
 
 	my $regex = qr/([^a-zA-Z0-9_.-])/;
 	$str =~ s/$regex/sprintf("%%%02x", ord($1))/ge;
-	# for Apache 2.0.x prior to 2.0.44 we escape strings twic;
-	if ($ENV{SERVER_SIGNATURE} =~  /Apache\/2\.0\.(\d+)/ && $1 < 44) {
-		$str =~ s/$regex/sprintf("%%%02x", ord($1))/ge;
-	}
 	$str;
 }
 
@@ -361,17 +357,19 @@
 
 sub callproc {
 	my $self = shift @_;
-	my $procname = shift @_;
+	my %args = @_;
+	my $procname = $args{procname};
+	my @args = @{$args{args}};
 	my $argstr = "";
 	my @results;
-	for (1 .. scalar @_){
+	for (1 .. scalar @args){
 		$argstr .= "?, ";
 	}
 	$argstr =~ s/\, $//;
 	my $query = "SELECT * FROM $procname()";
 	$query =~ s/\(\)/($argstr)/;
 	my $sth = $self->{dbh}->prepare($query);
-	$sth->execute(@_);
+	$sth->execute(@args);
 	while (my $ref = $sth->fetchrow_hashref('NAME_lc')){
 		push @results, $ref;
 	}


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