@@ -71,7 +71,7 @@ |
||
71 | 71 | "char" => "md5/sha1/password/encrypt/uuid", |
72 | 72 | "binary" => "md5/sha1", |
73 | 73 | "date|time" => "now", |
74 | - ],[ |
|
74 | + ], [ |
|
75 | 75 | // $this->numberRegex() => "+/-", |
76 | 76 | "date" => "+ interval/- interval", |
77 | 77 | "time" => "addtime/subtime", |
@@ -94,11 +94,9 @@ |
||
94 | 94 | { |
95 | 95 | if (extension_loaded("mysqli")) { |
96 | 96 | $connection = new Db\MySqli\Connection($this, $this->util, $this->trans, 'MySQLi'); |
97 | - } |
|
98 | - elseif (extension_loaded("pdo_mysql")) { |
|
97 | + } elseif (extension_loaded("pdo_mysql")) { |
|
99 | 98 | $connection = new Db\Pdo\Connection($this, $this->util, $this->trans, 'PDO_MySQL'); |
100 | - } |
|
101 | - else { |
|
99 | + } else { |
|
102 | 100 | throw new AuthException($this->trans->lang('No package installed to connect to a MySQL server.')); |
103 | 101 | } |
104 | 102 |
@@ -12,8 +12,8 @@ |
||
12 | 12 | class Connection extends AbstractConnection |
13 | 13 | { |
14 | 14 | /** |
15 | - * @inheritDoc |
|
16 | - */ |
|
15 | + * @inheritDoc |
|
16 | + */ |
|
17 | 17 | public function open(string $database, string $schema = '') |
18 | 18 | { |
19 | 19 | $server = $this->driver->options('server'); |
@@ -25,8 +25,7 @@ discard block |
||
25 | 25 | $query = ($fast && $this->driver->minVersion(5)) ? |
26 | 26 | "SELECT TABLE_NAME AS Name, ENGINE AS Engine, TABLE_COMMENT AS Comment " . |
27 | 27 | "FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() " . |
28 | - ($table != "" ? "AND TABLE_NAME = " . $this->driver->quote($table) : "ORDER BY Name") : |
|
29 | - "SHOW TABLE STATUS" . ($table != "" ? " LIKE " . $this->driver->quote(addcslashes($table, "%_\\")) : ""); |
|
28 | + ($table != "" ? "AND TABLE_NAME = " . $this->driver->quote($table) : "ORDER BY Name") : "SHOW TABLE STATUS" . ($table != "" ? " LIKE " . $this->driver->quote(addcslashes($table, "%_\\")) : ""); |
|
30 | 29 | return $this->driver->rows($query); |
31 | 30 | } |
32 | 31 | |
@@ -142,8 +141,7 @@ discard block |
||
142 | 141 | $index = new IndexEntity(); |
143 | 142 | |
144 | 143 | $name = $row["Key_name"]; |
145 | - $index->type = ($name == "PRIMARY" ? "PRIMARY" : |
|
146 | - ($row["Index_type"] == "FULLTEXT" ? "FULLTEXT" : ($row["Non_unique"] ? |
|
144 | + $index->type = ($name == "PRIMARY" ? "PRIMARY" : ($row["Index_type"] == "FULLTEXT" ? "FULLTEXT" : ($row["Non_unique"] ? |
|
147 | 145 | ($row["Index_type"] == "SPATIAL" ? "SPATIAL" : "INDEX") : "UNIQUE"))); |
148 | 146 | $index->columns[] = $row["Column_name"]; |
149 | 147 | $index->lengths[] = ($row["Index_type"] == "SPATIAL" ? null : $row["Sub_part"]); |
@@ -183,10 +181,10 @@ discard block |
||
183 | 181 | |
184 | 182 | $foreignKey->database = $this->driver->unescapeId($match4 != "" ? $match3 : $match4); |
185 | 183 | $foreignKey->table = $this->driver->unescapeId($match4 != "" ? $match4 : $match3); |
186 | - $foreignKey->source = array_map(function ($idf) { |
|
184 | + $foreignKey->source = array_map(function($idf) { |
|
187 | 185 | return $this->driver->unescapeId($idf); |
188 | 186 | }, $source[0]); |
189 | - $foreignKey->target = array_map(function ($idf) { |
|
187 | + $foreignKey->target = array_map(function($idf) { |
|
190 | 188 | return $this->driver->unescapeId($idf); |
191 | 189 | }, $target[0]); |
192 | 190 | $foreignKey->onDelete = $matchCount > 6 ? $match[6] : "RESTRICT"; |
@@ -208,8 +206,7 @@ discard block |
||
208 | 206 | foreach ($fields as $field) { |
209 | 207 | $alter[] = ($field[1] ? ($table != "" ? ($field[0] != "" ? "CHANGE " . |
210 | 208 | $this->driver->escapeId($field[0]) : "ADD") : " ") . " " . |
211 | - implode($field[1]) . ($table != "" ? $field[2] : "") : |
|
212 | - "DROP " . $this->driver->escapeId($field[0]) |
|
209 | + implode($field[1]) . ($table != "" ? $field[2] : "") : "DROP " . $this->driver->escapeId($field[0]) |
|
213 | 210 | ); |
214 | 211 | } |
215 | 212 | $alter = array_merge($alter, $foreign); |
@@ -15,8 +15,7 @@ discard block |
||
15 | 15 | { |
16 | 16 | // !!! Caching and slow query handling are temporarily disabled !!! |
17 | 17 | $query = $this->driver->minVersion(5) ? |
18 | - "SELECT SCHEMA_NAME FROM information_schema.SCHEMATA ORDER BY SCHEMA_NAME" : |
|
19 | - "SHOW DATABASES"; |
|
18 | + "SELECT SCHEMA_NAME FROM information_schema.SCHEMATA ORDER BY SCHEMA_NAME" : "SHOW DATABASES"; |
|
20 | 19 | return $this->driver->values($query); |
21 | 20 | |
22 | 21 | // SHOW DATABASES can take a very long time so it is cached |
@@ -91,8 +90,7 @@ discard block |
||
91 | 90 | public function tables() |
92 | 91 | { |
93 | 92 | return $this->driver->keyValues($this->driver->minVersion(5) ? |
94 | - "SELECT TABLE_NAME, TABLE_TYPE FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() ORDER BY TABLE_NAME" : |
|
95 | - "SHOW TABLES"); |
|
93 | + "SELECT TABLE_NAME, TABLE_TYPE FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() ORDER BY TABLE_NAME" : "SHOW TABLES"); |
|
96 | 94 | } |
97 | 95 | |
98 | 96 | /** |
@@ -112,7 +110,7 @@ discard block |
||
112 | 110 | */ |
113 | 111 | public function dropViews(array $views) |
114 | 112 | { |
115 | - $this->driver->execute("DROP VIEW " . implode(", ", array_map(function ($view) { |
|
113 | + $this->driver->execute("DROP VIEW " . implode(", ", array_map(function($view) { |
|
116 | 114 | return $this->driver->table($view); |
117 | 115 | }, $views))); |
118 | 116 | return true; |
@@ -123,7 +121,7 @@ discard block |
||
123 | 121 | */ |
124 | 122 | public function dropTables(array $tables) |
125 | 123 | { |
126 | - $this->driver->execute("DROP TABLE " . implode(", ", array_map(function ($table) { |
|
124 | + $this->driver->execute("DROP TABLE " . implode(", ", array_map(function($table) { |
|
127 | 125 | return $this->driver->table($table); |
128 | 126 | }, $tables))); |
129 | 127 | return true; |
@@ -241,7 +239,7 @@ discard block |
||
241 | 239 | */ |
242 | 240 | public function dropDatabases(array $databases) |
243 | 241 | { |
244 | - return $this->driver->applyQueries("DROP DATABASE", $databases, function ($database) { |
|
242 | + return $this->driver->applyQueries("DROP DATABASE", $databases, function($database) { |
|
245 | 243 | return $this->driver->escapeId($database); |
246 | 244 | }); |
247 | 245 | } |