@@ -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'); |
@@ -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 |
@@ -121,7 +120,7 @@ discard block |
||
121 | 120 | */ |
122 | 121 | public function dropDatabases(array $databases) |
123 | 122 | { |
124 | - return $this->driver->applyQueries("DROP DATABASE", $databases, function ($database) { |
|
123 | + return $this->driver->applyQueries("DROP DATABASE", $databases, function($database) { |
|
125 | 124 | return $this->driver->escapeId($database); |
126 | 125 | }); |
127 | 126 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $clauses[] = 'DROP INDEX ' . $this->driver->escapeId($index->name); |
78 | 78 | } |
79 | 79 | foreach ($alter as $index) { |
80 | - $clauses[] = 'ADD ' . ($index->type == 'PRIMARY' ? 'PRIMARY KEY ' : $index->type . ' ') . |
|
80 | + $clauses[] = 'ADD ' . ($index->type == 'PRIMARY' ? 'PRIMARY KEY ' : $index->type . ' ') . |
|
81 | 81 | ($index->name != '' ? $this->driver->escapeId($index->name) . ' ' : '') . |
82 | 82 | '(' . implode(', ', $index->columns) . ')'; |
83 | 83 | } |
@@ -91,8 +91,7 @@ discard block |
||
91 | 91 | public function tables() |
92 | 92 | { |
93 | 93 | 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'); |
|
94 | + 'SELECT TABLE_NAME, TABLE_TYPE FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() ORDER BY TABLE_NAME' : 'SHOW TABLES'); |
|
96 | 95 | } |
97 | 96 | |
98 | 97 | /** |
@@ -112,7 +111,7 @@ discard block |
||
112 | 111 | */ |
113 | 112 | public function dropViews(array $views) |
114 | 113 | { |
115 | - $this->driver->execute('DROP VIEW ' . implode(', ', array_map(function ($view) { |
|
114 | + $this->driver->execute('DROP VIEW ' . implode(', ', array_map(function($view) { |
|
116 | 115 | return $this->driver->table($view); |
117 | 116 | }, $views))); |
118 | 117 | return true; |
@@ -123,7 +122,7 @@ discard block |
||
123 | 122 | */ |
124 | 123 | public function dropTables(array $tables) |
125 | 124 | { |
126 | - $this->driver->execute('DROP TABLE ' . implode(', ', array_map(function ($table) { |
|
125 | + $this->driver->execute('DROP TABLE ' . implode(', ', array_map(function($table) { |
|
127 | 126 | return $this->driver->table($table); |
128 | 127 | }, $tables))); |
129 | 128 | return true; |
@@ -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 | |
@@ -177,8 +176,7 @@ discard block |
||
177 | 176 | $index = new IndexEntity(); |
178 | 177 | |
179 | 178 | $name = $row["Key_name"]; |
180 | - $index->type = ($name == "PRIMARY" ? "PRIMARY" : |
|
181 | - ($row["Index_type"] == "FULLTEXT" ? "FULLTEXT" : ($row["Non_unique"] ? |
|
179 | + $index->type = ($name == "PRIMARY" ? "PRIMARY" : ($row["Index_type"] == "FULLTEXT" ? "FULLTEXT" : ($row["Non_unique"] ? |
|
182 | 180 | ($row["Index_type"] == "SPATIAL" ? "SPATIAL" : "INDEX") : "UNIQUE"))); |
183 | 181 | $index->columns[] = $row["Column_name"]; |
184 | 182 | $index->lengths[] = ($row["Index_type"] == "SPATIAL" ? null : $row["Sub_part"]); |
@@ -213,10 +211,10 @@ discard block |
||
213 | 211 | |
214 | 212 | $foreignKey->database = $this->driver->unescapeId($match[4] != "" ? $match[3] : $match[4]); |
215 | 213 | $foreignKey->table = $this->driver->unescapeId($match[4] != "" ? $match[4] : $match[3]); |
216 | - $foreignKey->source = array_map(function ($idf) { |
|
214 | + $foreignKey->source = array_map(function($idf) { |
|
217 | 215 | return $this->driver->unescapeId($idf); |
218 | 216 | }, $source[0]); |
219 | - $foreignKey->target = array_map(function ($idf) { |
|
217 | + $foreignKey->target = array_map(function($idf) { |
|
220 | 218 | return $this->driver->unescapeId($idf); |
221 | 219 | }, $target[0]); |
222 | 220 | $foreignKey->onDelete = $match[6] ?: "RESTRICT"; |