From 9ddc578b176d8fb5d6e13471d316a0be637a900f Mon Sep 17 00:00:00 2001 From: einhverfr Date: Thu, 15 Mar 2007 01:11:26 +0000 Subject: LedgerSMB->callproc() now uses named arguments git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@899 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB.pm | 12 +++++------- LedgerSMB/DBObject.pm | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/LedgerSMB.pm b/LedgerSMB.pm index 4fe53d2e..8f582f46 100755 --- a/LedgerSMB.pm +++ b/LedgerSMB.pm @@ -103,10 +103,6 @@ sub escape { 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 round_amount { 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; } diff --git a/LedgerSMB/DBObject.pm b/LedgerSMB/DBObject.pm index 4d6dabcb..e96cd5a4 100644 --- a/LedgerSMB/DBObject.pm +++ b/LedgerSMB/DBObject.pm @@ -99,7 +99,7 @@ sub exec_method { else { @call_args = @_; } - $self->callproc($funcname, @call_args); + $self->callproc(procname => $funcname, args => \@call_args); } sub run_custom_queries { -- cgit v1.2.3