summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-09-26 05:01:35 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-09-26 05:01:35 +0000
commit7f53db71cc63609b2b14ca903fff25ae75b25f7b (patch)
tree10826362e30594d5a8b1d96ec89dbfe42c1234cc
parentd922bf952a08442f542c6104f358952d81e8bedf (diff)
Applying David Mora's patch to DBObject.pm
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1661 4979c152-3d1c-0410-bac9-87ea11338e46
-rw-r--r--LedgerSMB/DBObject.pm27
1 files changed, 17 insertions, 10 deletions
diff --git a/LedgerSMB/DBObject.pm b/LedgerSMB/DBObject.pm
index e337e66c..657b30e5 100644
--- a/LedgerSMB/DBObject.pm
+++ b/LedgerSMB/DBObject.pm
@@ -54,6 +54,8 @@ sub AUTOLOAD {
$self->exec_method( funcname => "$type" . "_" . $AUTOLOAD, args => \@_);
}
+sub DESTROY {}
+
sub new {
my $class = shift @_;
my %args = (ref($_[0]) eq 'HASH')? %{$_[0]}: @_;
@@ -104,13 +106,14 @@ sub exec_method {
my @in_args;
@in_args = @{ $args{args}} if $args{args};
my @call_args;
-
+
my $query = "SELECT proname, pronargs, proargnames FROM pg_proc WHERE proname = ?";
my $sth = $self->{dbh}->prepare($query);
$sth->execute($funcname);
my $ref;
$ref = $sth->fetchrow_hashref('NAME_lc');
+
my $args = $ref->{proargnames};
my @proc_args;
$ref->{pronargs} = 0 unless defined $ref->{pronargs};
@@ -118,19 +121,23 @@ sub exec_method {
$args =~ s/\{(.*)\}/$1/;
@proc_args = split /,/, $args if $args;
}
+
if ( !$ref->{proname} ) { # no such function
- $self->error( "No such function: ", $funcname );
- die;
+
+ $self->error( "No such function: $funcname");
+# die;
}
+
my $m_name = $ref->{proname};
- if ($args) {
- for my $arg (@proc_args) {
- if ( $arg =~ s/^in_// ) {
- push @call_args, $self->{$arg};
- }
- }
- }
+# if ($args) {
+# for my $arg (@proc_args) {
+# if ( $arg =~ s/^in_// ) {
+ # push @call_args, $arg;
+# }
+# }
+# }
+
for (@in_args) { push @call_args, $_ } ;
$self->{call_args} = \@call_args;
$self->debug({file => '/tmp/dbobject'});