@@ -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 | $connection = null; |
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'); |
@@ -21,8 +21,7 @@ discard block |
||
21 | 21 | $tables = []; |
22 | 22 | foreach ($this->driver->rows($fast && $this->driver->minVersion(5) ? |
23 | 23 | "SELECT TABLE_NAME AS Name, ENGINE AS Engine, TABLE_COMMENT AS Comment FROM information_schema.TABLES " . |
24 | - "WHERE TABLE_SCHEMA = DATABASE() " . ($table != "" ? "AND TABLE_NAME = " . $this->driver->quote($table) : "ORDER BY Name") : |
|
25 | - "SHOW TABLE STATUS" . ($table != "" ? " LIKE " . $this->driver->quote(addcslashes($table, "%_\\")) : "") |
|
24 | + "WHERE TABLE_SCHEMA = DATABASE() " . ($table != "" ? "AND TABLE_NAME = " . $this->driver->quote($table) : "ORDER BY Name") : "SHOW TABLE STATUS" . ($table != "" ? " LIKE " . $this->driver->quote(addcslashes($table, "%_\\")) : "") |
|
26 | 25 | ) as $row) { |
27 | 26 | $status = new TableEntity($row['Name']); |
28 | 27 | $status->engine = $row['Engine']; |
@@ -108,8 +107,7 @@ discard block |
||
108 | 107 | $index = new IndexEntity(); |
109 | 108 | |
110 | 109 | $name = $row["Key_name"]; |
111 | - $index->type = ($name == "PRIMARY" ? "PRIMARY" : |
|
112 | - ($row["Index_type"] == "FULLTEXT" ? "FULLTEXT" : ($row["Non_unique"] ? |
|
110 | + $index->type = ($name == "PRIMARY" ? "PRIMARY" : ($row["Index_type"] == "FULLTEXT" ? "FULLTEXT" : ($row["Non_unique"] ? |
|
113 | 111 | ($row["Index_type"] == "SPATIAL" ? "SPATIAL" : "INDEX") : "UNIQUE"))); |
114 | 112 | $index->columns[] = $row["Column_name"]; |
115 | 113 | $index->lengths[] = ($row["Index_type"] == "SPATIAL" ? null : $row["Sub_part"]); |
@@ -148,10 +146,10 @@ discard block |
||
148 | 146 | |
149 | 147 | $foreignKey->db = $this->driver->unescapeId($match4 != "" ? $match3 : $match4); |
150 | 148 | $foreignKey->table = $this->driver->unescapeId($match4 != "" ? $match4 : $match3); |
151 | - $foreignKey->source = array_map(function ($idf) { |
|
149 | + $foreignKey->source = array_map(function($idf) { |
|
152 | 150 | return $this->driver->unescapeId($idf); |
153 | 151 | }, $source[0]); |
154 | - $foreignKey->target = array_map(function ($idf) { |
|
152 | + $foreignKey->target = array_map(function($idf) { |
|
155 | 153 | return $this->driver->unescapeId($idf); |
156 | 154 | }, $target[0]); |
157 | 155 | $foreignKey->onDelete = $matchCount > 6 ? $match[6] : "RESTRICT"; |
@@ -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 | - return $this->driver->queries("DROP VIEW " . implode(", ", array_map(function ($view) { |
|
113 | + return $this->driver->queries("DROP VIEW " . implode(", ", array_map(function($view) { |
|
116 | 114 | return $this->driver->table($view); |
117 | 115 | }, $views))); |
118 | 116 | } |
@@ -122,7 +120,7 @@ discard block |
||
122 | 120 | */ |
123 | 121 | public function dropTables(array $tables) |
124 | 122 | { |
125 | - return $this->driver->queries("DROP TABLE " . implode(", ", array_map(function ($table) { |
|
123 | + return $this->driver->queries("DROP TABLE " . implode(", ", array_map(function($table) { |
|
126 | 124 | return $this->driver->table($table); |
127 | 125 | }, $tables))); |
128 | 126 | } |
@@ -238,7 +236,7 @@ discard block |
||
238 | 236 | */ |
239 | 237 | public function dropDatabases(array $databases) |
240 | 238 | { |
241 | - return $this->driver->applyQueries("DROP DATABASE", $databases, function ($database) { |
|
239 | + return $this->driver->applyQueries("DROP DATABASE", $databases, function($database) { |
|
242 | 240 | return $this->driver->escapeId($database); |
243 | 241 | }); |
244 | 242 | } |