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

SF.net SVN: ledger-smb:[4201] branches/1.3/LedgerSMB/Form.pm



Revision: 4201
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4201&view=rev
Author:   tshvr
Date:     2011-12-12 13:58:35 +0000 (Mon, 12 Dec 2011)
Log Message:
-----------
dbi trace,update_defaults not respecting signature description,avoid duplicating var

Modified Paths:
--------------
    branches/1.3/LedgerSMB/Form.pm

Modified: branches/1.3/LedgerSMB/Form.pm
===================================================================
--- branches/1.3/LedgerSMB/Form.pm	2011-12-12 12:12:13 UTC (rev 4200)
+++ branches/1.3/LedgerSMB/Form.pm	2011-12-12 13:58:35 UTC (rev 4201)
@@ -1535,6 +1535,13 @@
     ) or $self->dberror;
     #HV trying to trace DBI->connect statements
     $logger->debug("DBI->connect dbh=$dbh");
+    my $dbi_trace=$LedgerSMB::Sysconfig::DBI_TRACE;
+    if($dbi_trace)
+    {
+     $logger->debug("\$dbi_trace=$dbi_trace");
+     $dbh->trace(split /=/,$dbi_trace,2);#http://search.cpan.org/~timb/DBI-1.616/DBI.pm#TRACING
+    }
+
     $dbh->{pg_enable_utf8} = 1;
 
     # set db options
@@ -3373,22 +3380,22 @@
 
 sub update_defaults {
 
-    my ( $self, $myconfig, $fld, $nocommit) = @_;
+    my ( $self, $myconfig, $fld,$dbh_parm,$nocommit) = @_;
 
     if ( !$self->{dbh} && $self ) {
         $self->db_init($myconfig);
     }
 
-    my $dbh = $self->{dbh};
+    #my $dbh = $self->{dbh};
 
-    if ( !$self ) {
-        $dbh = $_[3];
-    }
+    #if ( !$self ) { #if !$self, previous statement would already have failed!
+    #    $dbh = $_[3];
+    #}
 
     my $query = qq|
 		SELECT value FROM defaults 
 		 WHERE setting_key = ? FOR UPDATE|;
-    my $sth = $dbh->prepare($query);
+    my $sth = $self->{dbh}->prepare($query);
     $sth->execute($fld);
     ($_) = $sth->fetchrow_array();
 
@@ -3512,10 +3519,10 @@
 		   SET value = ?
 		 WHERE setting_key = ?|;
 
-    $sth = $dbh->prepare($query);
+    $sth = $self->{dbh}->prepare($query);
     $sth->execute( $dbvar, $fld ) || $self->dberror($query);
 
-    $dbh->commit if !defined $nocommit;
+    $self->{dbh}->commit if !defined $nocommit;
 
     $var;
 }

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