diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-03-15 01:11:26 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-03-15 01:11:26 +0000 |
commit | 9ddc578b176d8fb5d6e13471d316a0be637a900f (patch) | |
tree | 829d9628e5a80ad0f527d056ef263e97fee4d3bd | |
parent | c97ad04509d3f96fd9928d88eb191f4a84808f42 (diff) |
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
-rwxr-xr-x | LedgerSMB.pm | 12 | ||||
-rw-r--r-- | 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 { |