From e9833091a7e25df0df7070c708552a746016adc2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 17 Jun 2006 17:57:41 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20Dans=20un=20context=20de=20transactions?= =?UTF-8?q?=20imbriqu=E9es,=20le=20commit=20pouvait=20se=20faire=20dans=20?= =?UTF-8?q?un=20sous=20niveau?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/lib/mysql.lib.php | 5 +++-- htdocs/lib/pgsql.lib.php | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/lib/mysql.lib.php b/htdocs/lib/mysql.lib.php index 1d4675e0222..8766843c6d9 100644 --- a/htdocs/lib/mysql.lib.php +++ b/htdocs/lib/mysql.lib.php @@ -326,7 +326,7 @@ class DoliDb function commit() { - if ($this->transaction_opened==1) + if ($this->transaction_opened<=1) { $ret=$this->query("COMMIT"); if ($ret) $this->transaction_opened=0; @@ -346,7 +346,7 @@ class DoliDb function rollback() { - if ($this->transaction_opened==1) + if ($this->transaction_opened<=1) { $ret=$this->query("ROLLBACK"); $this->transaction_opened=0; @@ -354,6 +354,7 @@ class DoliDb } else { + $this->transaction_opened--; return 1; } } diff --git a/htdocs/lib/pgsql.lib.php b/htdocs/lib/pgsql.lib.php index b206a533088..0282240a82c 100644 --- a/htdocs/lib/pgsql.lib.php +++ b/htdocs/lib/pgsql.lib.php @@ -307,7 +307,7 @@ class DoliDb */ function commit() { - if ($this->transaction_opened==1) + if ($this->transaction_opened<=1) { $ret=$this->query("COMMIT;"); if ($ret) $this->transaction_opened=0; @@ -326,7 +326,7 @@ class DoliDb */ function rollback() { - if ($this->transaction_opened==1) + if ($this->transaction_opened<=1) { $ret=$this->query("ROLLBACK;"); $this->transaction_opened=0; @@ -334,6 +334,7 @@ class DoliDb } else { + $this->transaction_opened--; return 1; } }