More info into log

This commit is contained in:
Laurent Destailleur 2013-06-25 15:47:59 +02:00
parent c2654fa7e2
commit 285ea8da3f
2 changed files with 10 additions and 8 deletions

View File

@ -56,15 +56,16 @@ class DoliDBPgsql
//! >=1 if a transaction is opened, 0 otherwise
var $transaction_opened;
var $lastquery;
var $lastqueryerror; // Ajout d'une variable en cas d'erreur
// Saved last error
var $lastqueryerror;
var $lasterror;
var $lasterrno;
var $unescapeslashquot=0; // By default we do not force the unescape of \'. This is used only to process sql with mysql escaped data.
var $standard_conforming_strings=1; // Database has option standard_conforming_strings to on
var $ok;
var $error;
var $lasterror;
/**
@ -583,17 +584,17 @@ class DoliDBPgsql
{
if (! $ret)
{
if ($this->errno() != 'DB_ERROR_25P02')
if ($this->errno() != 'DB_ERROR_25P02') // Do not overwrite errors if this is a consecutive error
{
$this->lastqueryerror = $query;
$this->lasterror = $this->error();
$this->lasterrno = $this->errno();
}
dol_syslog(get_class($this)."::query SQL error usesavepoint = ".$usesavepoint." - ".$query." - ".pg_last_error($this->db)." = ".$this->errno(), LOG_WARNING);
dol_syslog(get_class($this)."::query SQL error usesavepoint = ".$usesavepoint." - ".$query." - ".pg_last_error($this->db)." => ".$this->errno(), LOG_WARNING);
//print "\n>> ".$query."<br>\n";
//print '>> '.$this->lasterrno.' - '.$this->lasterror.' - '.$this->lastqueryerror."<br>\n";
if ($usesavepoint && $this->transaction_opened)
if ($usesavepoint && $this->transaction_opened) // Warning, after that errno will be erased
{
@pg_query($this->db, 'ROLLBACK TO SAVEPOINT mysavepoint');
}

View File

@ -894,11 +894,12 @@ abstract class DolibarrModules
if ($this->db->errno() != "DB_ERROR_RECORD_ALREADY_EXISTS")
{
$this->error=$this->db->lasterror();
dol_syslog(get_class($this)."::insert_permissions error ".$this->error, LOG_ERR);
dol_syslog(get_class($this)."::insert_permissions errno = ".$this->db->errno()." error ".$this->error, LOG_ERR);
$err++;
break;
}
else dol_syslog(get_class($this)."::insert_permissions record already exists", LOG_INFO);
}
$this->db->free($resqlinsert);