stanley-king 3 年 前
コミット
78615ff075
1 ファイル変更7 行追加5 行削除
  1. 7 5
      core/framework/db/mysqli.php

+ 7 - 5
core/framework/db/mysqli.php

@@ -114,7 +114,8 @@ class Db
     {
         self::init_link();
         $count = 0;
-        do {
+        do
+        {
             $staer = new statistic_tm();
             $query = self::$link[$host]->query($sql);
             $staer->end();
@@ -133,13 +134,11 @@ class Db
                 } elseif (C('debug')) {
                     throw_exception($error . '<br/>' . $sql);
                     return false;
-                }
-                elseif(self::ping($host) == false) {
+                } elseif (self::ping($host) == false) {
                     if ($count > 0) return false;
                     self::connect($host);
                     $count++;
-                }
-                else {
+                } else {
                     return false;
                 }
             }
@@ -609,6 +608,7 @@ class Db
 
         if (self::$ifTransacting === 0) {
             self::$link[$host]->autocommit(false);
+            Log::record("transaction begin",Log::DEBUG);
         }
         self::$ifTransacting += 1;
     }
@@ -621,6 +621,7 @@ class Db
         {
             $result = self::$link[$host]->commit();
             self::$link[$host]->autocommit(true);
+            Log::record("transaction commit",Log::DEBUG);
 
             if (!$result) {
                 $err = mysqli_error(self::$link[$host]);
@@ -638,6 +639,7 @@ class Db
         {
             $result = self::$link[$host]->rollback();
             $fsuccess = self::$link[$host]->autocommit(true);
+            Log::record("transaction rollback",Log::DEBUG);
 
             if (!$result || !$fsuccess) {
                 $err = mysqli_error(self::$link[$host]);