Fix: Dans un context de transactions imbriquées, le commit pouvait se faire dans un sous niveau

This commit is contained in:
Laurent Destailleur 2006-06-17 17:57:41 +00:00
parent e904da75ba
commit e9833091a7
2 changed files with 6 additions and 4 deletions

View File

@ -326,7 +326,7 @@ class DoliDb
function commit() function commit()
{ {
if ($this->transaction_opened==1) if ($this->transaction_opened<=1)
{ {
$ret=$this->query("COMMIT"); $ret=$this->query("COMMIT");
if ($ret) $this->transaction_opened=0; if ($ret) $this->transaction_opened=0;
@ -346,7 +346,7 @@ class DoliDb
function rollback() function rollback()
{ {
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;
@ -354,6 +354,7 @@ class DoliDb
} }
else else
{ {
$this->transaction_opened--;
return 1; return 1;
} }
} }

View File

@ -307,7 +307,7 @@ class DoliDb
*/ */
function commit() function commit()
{ {
if ($this->transaction_opened==1) if ($this->transaction_opened<=1)
{ {
$ret=$this->query("COMMIT;"); $ret=$this->query("COMMIT;");
if ($ret) $this->transaction_opened=0; if ($ret) $this->transaction_opened=0;
@ -326,7 +326,7 @@ class DoliDb
*/ */
function rollback() function rollback()
{ {
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;
@ -334,6 +334,7 @@ class DoliDb
} }
else else
{ {
$this->transaction_opened--;
return 1; return 1;
} }
} }