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

SF.net SVN: ledger-smb: [2211] trunk/LedgerSMB.pm



Revision: 2211
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=2211&view=rev
Author:   einhverfr
Date:     2008-07-10 17:42:05 -0700 (Thu, 10 Jul 2008)

Log Message:
-----------
Better logging and handling of db errors.

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

Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm	2008-07-10 19:46:02 UTC (rev 2210)
+++ trunk/LedgerSMB.pm	2008-07-11 00:42:05 UTC (rev 2211)
@@ -575,9 +575,9 @@
     $query =~ s/\(\)/($argstr)/;
     my $sth = $self->{dbh}->prepare($query);
     if (scalar @call_args){
-        $sth->execute(@call_args) || $self->error($self->{dbh}->errstr);
+        $sth->execute(@call_args) || $self->dberror($self->{dbh}->errstr);
     } else {
-        $sth->execute() || $self->error($self->{dbh}->errstr . ':' . $query);
+        $sth->execute() || $self->dberror($self->{dbh}->errstr . ':' . $query);
     }
    
     my @types = @{$sth->{TYPE}};
@@ -745,6 +745,11 @@
 # Deprecated, only here for old code
 sub dberror{
    my $self = shift @_;
+   if ($self->{dbh}->state eq '42501'){
+      $_[0] = $self->{_locale}->text('Access Denied'); 
+   }
+   print STDERR "Logging SQL State ".$self->{dbh}->state.", error ".
+           $self->{dbh}->err . ", string " .$self->{dbh}->errstr . "\n";
    $self->error(@_);
 }
 


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