From 285ea8da3f0eadd3c562b3d00583c5e8a4e6de5a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 25 Jun 2013 15:47:59 +0200 Subject: [PATCH] More info into log --- htdocs/core/db/pgsql.class.php | 15 ++++++++------- htdocs/core/modules/DolibarrModules.class.php | 3 ++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 2173738f4d5..6e670bd01c5 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -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."
\n"; //print '>> '.$this->lasterrno.' - '.$this->lasterror.' - '.$this->lastqueryerror."
\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'); } diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 73bf0c9e3d5..fc20ebe0f2f 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -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);