@@ -18,8 +18,7 @@ discard block |
||
| 18 | 18 | foreach ($fields as $field) { |
| 19 | 19 | $alter[] = ($field[1] ? ($table != '' ? ($field[0] != '' ? 'CHANGE ' . |
| 20 | 20 | $this->driver->escapeId($field[0]) : 'ADD') : ' ') . ' ' . |
| 21 | - implode($field[1]) . ($table != '' ? $field[2] : '') : |
|
| 22 | - 'DROP ' . $this->driver->escapeId($field[0]) |
|
| 21 | + implode($field[1]) . ($table != '' ? $field[2] : '') : 'DROP ' . $this->driver->escapeId($field[0]) |
|
| 23 | 22 | ); |
| 24 | 23 | } |
| 25 | 24 | $alter = array_merge($alter, $foreign); |
@@ -69,8 +68,7 @@ discard block |
||
| 69 | 68 | public function tables() |
| 70 | 69 | { |
| 71 | 70 | return $this->driver->keyValues($this->driver->minVersion(5) ? |
| 72 | - 'SELECT TABLE_NAME, TABLE_TYPE FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() ORDER BY TABLE_NAME' : |
|
| 73 | - 'SHOW TABLES'); |
|
| 71 | + 'SELECT TABLE_NAME, TABLE_TYPE FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() ORDER BY TABLE_NAME' : 'SHOW TABLES'); |
|
| 74 | 72 | } |
| 75 | 73 | |
| 76 | 74 | /** |
@@ -90,7 +88,7 @@ discard block |
||
| 90 | 88 | */ |
| 91 | 89 | public function dropViews(array $views) |
| 92 | 90 | { |
| 93 | - $this->driver->execute('DROP VIEW ' . implode(', ', array_map(function ($view) { |
|
| 91 | + $this->driver->execute('DROP VIEW ' . implode(', ', array_map(function($view) { |
|
| 94 | 92 | return $this->driver->table($view); |
| 95 | 93 | }, $views))); |
| 96 | 94 | return true; |
@@ -101,7 +99,7 @@ discard block |
||
| 101 | 99 | */ |
| 102 | 100 | public function dropTables(array $tables) |
| 103 | 101 | { |
| 104 | - $this->driver->execute('DROP TABLE ' . implode(', ', array_map(function ($table) { |
|
| 102 | + $this->driver->execute('DROP TABLE ' . implode(', ', array_map(function($table) { |
|
| 105 | 103 | return $this->driver->table($table); |
| 106 | 104 | }, $tables))); |
| 107 | 105 | return true; |
@@ -161,16 +159,14 @@ discard block |
||
| 161 | 159 | foreach ($this->driver->rows('SHOW TRIGGERS LIKE ' . $this->driver->quote(addcslashes($table, "%_\\"))) as $row) { |
| 162 | 160 | $trigger = $row['Trigger']; |
| 163 | 161 | if (!$this->driver->execute('CREATE TRIGGER ' . |
| 164 | - ($target == $this->driver->database() ? $this->driver->escapeId("copy_$trigger") : |
|
| 165 | - $this->driver->escapeId($target) . '.' . $this->driver->escapeId($trigger)) . |
|
| 162 | + ($target == $this->driver->database() ? $this->driver->escapeId("copy_$trigger") : $this->driver->escapeId($target) . '.' . $this->driver->escapeId($trigger)) . |
|
| 166 | 163 | " $row[Timing] $row[Event] ON $name FOR EACH ROW\n$row[Statement];")) { |
| 167 | 164 | return false; |
| 168 | 165 | } |
| 169 | 166 | } |
| 170 | 167 | } |
| 171 | 168 | foreach ($views as $table) { |
| 172 | - $name = ($target == $this->driver->database() ? $this->driver->table("copy_$table") : |
|
| 173 | - $this->driver->escapeId($target) . '.' . $this->driver->table($table)); |
|
| 169 | + $name = ($target == $this->driver->database() ? $this->driver->table("copy_$table") : $this->driver->escapeId($target) . '.' . $this->driver->table($table)); |
|
| 174 | 170 | $view = $this->driver->view($table); |
| 175 | 171 | if (($overwrite && !$this->driver->execute("DROP VIEW IF EXISTS $name")) |
| 176 | 172 | || !$this->driver->execute("CREATE VIEW $name AS $view[select]")) { //! USE to avoid db.table |