diff options
| author | 2014-10-31 17:21:20 +0100 | |
|---|---|---|
| committer | 2014-10-31 17:21:20 +0100 | |
| commit | 105729639bd06c27536bbdd2968873046278d59f (patch) | |
| tree | 30dcf7e3ae471b30810fb22ed701e0bb7d034fc8 /lib/Minz/ModelPdo.php | |
| parent | caf98a6468dcea5ae8c38062e4eb527cb3667db9 (diff) | |
| parent | ee50df518310d3aee5efb5a0c15548b457d10e7e (diff) | |
Merge branch 'beta' into hotfixes
Diffstat (limited to 'lib/Minz/ModelPdo.php')
| -rw-r--r-- | lib/Minz/ModelPdo.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Minz/ModelPdo.php b/lib/Minz/ModelPdo.php index b4bfca746..6198cd85c 100644 --- a/lib/Minz/ModelPdo.php +++ b/lib/Minz/ModelPdo.php @@ -16,6 +16,8 @@ class Minz_ModelPdo { public static $useSharedBd = true; private static $sharedBd = null; private static $sharedPrefix; + private static $has_transaction = false; + private static $sharedCurrentUser; protected static $sharedDbType; /** @@ -23,6 +25,7 @@ class Minz_ModelPdo { */ protected $bd; + protected $current_user; protected $prefix; public function dbType() { @@ -37,6 +40,7 @@ class Minz_ModelPdo { if (self::$useSharedBd && self::$sharedBd != null && $currentUser === null) { $this->bd = self::$sharedBd; $this->prefix = self::$sharedPrefix; + $this->current_user = self::$sharedCurrentUser; return; } @@ -45,6 +49,8 @@ class Minz_ModelPdo { if ($currentUser === null) { $currentUser = Minz_Session::param('currentUser', '_'); } + $this->current_user = $currentUser; + self::$sharedCurrentUser = $currentUser; try { $type = $db['type']; @@ -91,12 +97,18 @@ class Minz_ModelPdo { public function beginTransaction() { $this->bd->beginTransaction(); + self::$has_transaction = true; + } + public function hasTransaction() { + return self::$has_transaction; } public function commit() { $this->bd->commit(); + self::$has_transaction = false; } public function rollBack() { $this->bd->rollBack(); + self::$has_transaction = false; } public static function clean() { |
