Implemented rollback according to interface for Microsoft SQL and PostgreSQL

This commit is contained in:
Raphaël Doursenaud 2014-02-21 14:40:10 +01:00
parent 894ac6fdc0
commit 283fec164e
2 changed files with 8 additions and 6 deletions

View File

@ -310,15 +310,16 @@ class DoliDBMssql extends DoliDB
/** /**
* Annulation d'une transaction et retour aux anciennes valeurs * Annulation d'une transaction et retour aux anciennes valeurs
* *
* @param string $log Add more log to default log line
* @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur * @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 TRANSACTION"); $ret=$this->query("ROLLBACK TRANSACTION");
$this->transaction_opened=0; $this->transaction_opened=0;
dol_syslog("ROLLBACK Transaction",LOG_DEBUG); dol_syslog("ROLLBACK Transaction".($log?' '.$log:''),LOG_DEBUG);
return $ret; return $ret;
} }
else else

View File

@ -541,16 +541,17 @@ class DoliDBPgsql extends DoliDB
/** /**
* Annulation d'une transaction et retour aux anciennes valeurs * Annulation d'une transaction et retour aux anciennes valeurs
* *
* @param string $log Add more log to default log line
* @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur * @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
*/ */
function rollback() function rollback($log='')
{ {
dol_syslog('',0,-1); dol_syslog('',0,-1);
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;
dol_syslog("ROLLBACK Transaction",LOG_DEBUG); dol_syslog("ROLLBACK Transaction".($log?' '.$log:''),LOG_DEBUG);
return $ret; return $ret;
} }
else else