@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $this->config = $config; |
| 80 | 80 | $this->name = $name ?? 'anonymous'; |
| 81 | 81 | $this->observer = new NullObserver; |
| 82 | - register_shutdown_function(function () { |
|
| 82 | + register_shutdown_function(function() { |
|
| 83 | 83 | $this->onBeforeSystemShutdown(); |
| 84 | 84 | }); |
| 85 | 85 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | try { |
| 108 | 108 | $this->pdo = $this->createPDO(); |
| 109 | 109 | $this->id = static::$connectionCount; |
| 110 | - static::$connectionCount ++; |
|
| 110 | + static::$connectionCount++; |
|
| 111 | 111 | } catch (PDOException $e) { |
| 112 | 112 | throw new SQLException(sprintf( |
| 113 | 113 | "%s connect database error:%s", |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | public function beginTransaction() |
| 182 | 182 | { |
| 183 | - $this->transaction ++; |
|
| 183 | + $this->transaction++; |
|
| 184 | 184 | if ($this->transaction == 1) { |
| 185 | 185 | $this->pdo->beginTransaction(); |
| 186 | 186 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $password = $this->config['password'] ?? ''; |
| 46 | 46 | $pdo = new PDO($this->getDsn(), $user, $password); |
| 47 | 47 | $this->id = static::$connectionCount; |
| 48 | - static::$connectionCount ++; |
|
| 48 | + static::$connectionCount++; |
|
| 49 | 49 | return $pdo; |
| 50 | 50 | } catch (PDOException $e) { |
| 51 | 51 | throw new SQLException(sprintf( |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function switchDatabase(string $database) |
| 66 | 66 | { |
| 67 | - return $this->query(new QueryStatement('USE `' . $database.'`')); |
|
| 67 | + return $this->query(new QueryStatement('USE `'.$database.'`')); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | public function rawTableName(string $name) |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | try { |
| 41 | 41 | $pdo = new PDO($this->getDsn()); |
| 42 | 42 | $this->id = static::$connectionCount; |
| 43 | - static::$connectionCount ++; |
|
| 43 | + static::$connectionCount++; |
|
| 44 | 44 | return $pdo; |
| 45 | 45 | } catch (PDOException $e) { |
| 46 | 46 | throw new SQLException( |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function switchDatabase(string $database) |
| 64 | 64 | { |
| 65 | - return $this->query(new QueryStatement('USE `' . $database.'`')); |
|
| 65 | + return $this->query(new QueryStatement('USE `'.$database.'`')); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -77,8 +77,8 @@ |
||
| 77 | 77 | protected function modifyQueryStatement(QueryStatement $statement):QueryStatement |
| 78 | 78 | { |
| 79 | 79 | $type = $this->config['type'] ?? 'read'; |
| 80 | - if (in_array($type, ['read','write'])) { |
|
| 81 | - $statement->setType($type === 'read'?QueryStatement::READ:QueryStatement::WRITE); |
|
| 80 | + if (in_array($type, ['read', 'write'])) { |
|
| 81 | + $statement->setType($type === 'read' ?QueryStatement::READ : QueryStatement::WRITE); |
|
| 82 | 82 | } |
| 83 | 83 | if (array_key_exists('return-type', $this->config)) { |
| 84 | 84 | $statement->setReturnType($this->config['return-type']); |