Skip to content
Snippets Groups Projects
Commit 7a98515b authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Add option to add log info in commit and rollback functions

parent 6493af16
No related branches found
No related tags found
No related merge requests found
...@@ -299,10 +299,11 @@ class DoliDb ...@@ -299,10 +299,11 @@ class DoliDb
} }
/** /**
\brief Validation d'une transaction * \brief Validation d'une transaction
\return int 1 si validation ok ou niveau de transaction non ouverte, 0 en cas d'erreur * \param log Add more log to default log line
* \return int 1 si validation ok ou niveau de transaction non ouverte, 0 en cas d'erreur
*/ */
function commit() function commit($log='')
{ {
if ($this->transaction_opened<=1) if ($this->transaction_opened<=1)
{ {
...@@ -310,7 +311,7 @@ class DoliDb ...@@ -310,7 +311,7 @@ class DoliDb
if ($ret) if ($ret)
{ {
$this->transaction_opened=0; $this->transaction_opened=0;
dolibarr_syslog("COMMIT Transaction",LOG_DEBUG); dolibarr_syslog("COMMIT Transaction".($log?' '.$log:''),LOG_DEBUG);
} }
return $ret; return $ret;
} }
...@@ -322,16 +323,17 @@ class DoliDb ...@@ -322,16 +323,17 @@ class DoliDb
} }
/** /**
\brief Annulation d'une transaction et retour aux anciennes valeurs * \brief Annulation d'une transaction et retour aux anciennes valeurs
\return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur * \param log Add more log to default log line
* \return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
*/ */
function rollback() function rollback($log='')
{ {
if ($this->transaction_opened<=1) if ($this->transaction_opened<=1)
{ {
$ret=$this->query("ROLLBACK"); $ret=$this->query("ROLLBACK");
$this->transaction_opened=0; $this->transaction_opened=0;
dolibarr_syslog("ROLLBACK Transaction",LOG_DEBUG); dolibarr_syslog("ROLLBACK Transaction".($log?' '.$log:''),LOG_DEBUG);
return $ret; return $ret;
} }
else else
......
...@@ -305,10 +305,11 @@ class DoliDb ...@@ -305,10 +305,11 @@ class DoliDb
} }
/** /**
\brief Validation d'une transaction * \brief Validation d'une transaction
\return int 1 si validation ok ou niveau de transaction non ouverte, 0 en cas d'erreur * \param log Add more log to default log line
* \return int 1 si validation ok ou niveau de transaction non ouverte, 0 en cas d'erreur
*/ */
function commit() function commit($log='')
{ {
if ($this->transaction_opened<=1) if ($this->transaction_opened<=1)
{ {
...@@ -316,7 +317,7 @@ class DoliDb ...@@ -316,7 +317,7 @@ class DoliDb
if ($ret) if ($ret)
{ {
$this->transaction_opened=0; $this->transaction_opened=0;
dolibarr_syslog("COMMIT Transaction",LOG_DEBUG); dolibarr_syslog("COMMIT Transaction".($log?' '.$log:''),LOG_DEBUG);
} }
return $ret; return $ret;
} }
...@@ -328,16 +329,17 @@ class DoliDb ...@@ -328,16 +329,17 @@ class DoliDb
} }
/** /**
\brief Annulation d'une transaction et retour aux anciennes valeurs * \brief Annulation d'une transaction et retour aux anciennes valeurs
\return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur * \param log Add more log to default log line
* \return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
*/ */
function rollback() function rollback($log='')
{ {
if ($this->transaction_opened<=1) if ($this->transaction_opened<=1)
{ {
$ret=$this->query("ROLLBACK"); $ret=$this->query("ROLLBACK");
$this->transaction_opened=0; $this->transaction_opened=0;
dolibarr_syslog("ROLLBACK Transaction",LOG_DEBUG); dolibarr_syslog("ROLLBACK Transaction".($log?' '.$log:''),LOG_DEBUG);
return $ret; return $ret;
} }
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment