@@ -158,25 +158,25 @@ discard block |
||
| 158 | 158 | $this->parseDsn($dsn); |
| 159 | 159 | |
| 160 | 160 | // this drops MYSQL dependency, only use the constant if it's defined |
| 161 | - if ( "mysql" === $this->dbType ) { |
|
| 161 | + if ("mysql" === $this->dbType) { |
|
| 162 | 162 | $pdoSettingsDefault[PDO::MYSQL_ATTR_USE_BUFFERED_QUERY] = false; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | $this->pdoSettings = self::array_replace_recursive($pdoSettingsDefault, $pdoSettings); |
| 166 | 166 | $this->dumpSettings = self::array_replace_recursive($dumpSettingsDefault, $dumpSettings); |
| 167 | - $this->dumpSettings['init_commands'][] = "SET NAMES " . $this->dumpSettings['default-character-set']; |
|
| 167 | + $this->dumpSettings['init_commands'][] = "SET NAMES ".$this->dumpSettings['default-character-set']; |
|
| 168 | 168 | |
| 169 | 169 | if (false === $this->dumpSettings['skip-tz-utc']) { |
| 170 | 170 | $this->dumpSettings['init_commands'][] = "SET TIME_ZONE='+00:00'"; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | $diff = array_diff(array_keys($this->dumpSettings), array_keys($dumpSettingsDefault)); |
| 174 | - if (count($diff)>0) { |
|
| 175 | - throw new Exception("Unexpected value in dumpSettings: (" . implode(",", $diff) . ")"); |
|
| 174 | + if (count($diff) > 0) { |
|
| 175 | + throw new Exception("Unexpected value in dumpSettings: (".implode(",", $diff).")"); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - if ( !is_array($this->dumpSettings['include-tables']) || |
|
| 179 | - !is_array($this->dumpSettings['exclude-tables']) ) { |
|
| 178 | + if (!is_array($this->dumpSettings['include-tables']) || |
|
| 179 | + !is_array($this->dumpSettings['exclude-tables'])) { |
|
| 180 | 180 | throw new Exception("Include-tables and exclude-tables should be arrays"); |
| 181 | 181 | } |
| 182 | 182 | |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | $dsn = substr($dsn, $pos + 1); |
| 247 | 247 | |
| 248 | - foreach(explode(";", $dsn) as $kvp) { |
|
| 248 | + foreach (explode(";", $dsn) as $kvp) { |
|
| 249 | 249 | $kvpArr = explode("=", $kvp); |
| 250 | 250 | $this->dsnArray[strtolower($kvpArr[0])] = $kvpArr[1]; |
| 251 | 251 | } |
@@ -255,8 +255,7 @@ discard block |
||
| 255 | 255 | throw new Exception("Missing host from DSN string"); |
| 256 | 256 | } |
| 257 | 257 | $this->host = (!empty($this->dsnArray['host'])) ? |
| 258 | - $this->dsnArray['host'] : |
|
| 259 | - $this->dsnArray['unix_socket']; |
|
| 258 | + $this->dsnArray['host'] : $this->dsnArray['unix_socket']; |
|
| 260 | 259 | |
| 261 | 260 | if (empty($this->dsnArray['dbname'])) { |
| 262 | 261 | throw new Exception("Missing database name from DSN string"); |
@@ -265,7 +264,7 @@ discard block |
||
| 265 | 264 | $this->dbName = $this->dsnArray['dbname']; |
| 266 | 265 | |
| 267 | 266 | // safety check |
| 268 | - if ( !is_string($this->dbType) ) { |
|
| 267 | + if (!is_string($this->dbType)) { |
|
| 269 | 268 | throw new Exception("Invalid database type definition in DSN string"); |
| 270 | 269 | } |
| 271 | 270 | |
@@ -283,7 +282,7 @@ discard block |
||
| 283 | 282 | try { |
| 284 | 283 | switch ($this->dbType) { |
| 285 | 284 | case 'sqlite': |
| 286 | - $this->dbHandler = @new PDO("sqlite:" . $this->dbName, null, null, $this->pdoSettings); |
|
| 285 | + $this->dbHandler = @new PDO("sqlite:".$this->dbName, null, null, $this->pdoSettings); |
|
| 287 | 286 | break; |
| 288 | 287 | case 'mysql': |
| 289 | 288 | case 'pgsql': |
@@ -295,24 +294,24 @@ discard block |
||
| 295 | 294 | $this->pdoSettings |
| 296 | 295 | ); |
| 297 | 296 | // Execute init commands once connected |
| 298 | - foreach($this->dumpSettings['init_commands'] as $stmt) { |
|
| 297 | + foreach ($this->dumpSettings['init_commands'] as $stmt) { |
|
| 299 | 298 | $this->dbHandler->exec($stmt); |
| 300 | 299 | } |
| 301 | 300 | // Store server version |
| 302 | 301 | $this->version = $this->dbHandler->getAttribute(PDO::ATTR_SERVER_VERSION); |
| 303 | 302 | break; |
| 304 | 303 | default: |
| 305 | - throw new Exception("Unsupported database type (" . $this->dbType . ")"); |
|
| 304 | + throw new Exception("Unsupported database type (".$this->dbType.")"); |
|
| 306 | 305 | } |
| 307 | 306 | } catch (PDOException $e) { |
| 308 | 307 | throw new Exception( |
| 309 | - "Connection to " . $this->dbType . " failed with message: " . |
|
| 308 | + "Connection to ".$this->dbType." failed with message: ". |
|
| 310 | 309 | $e->getMessage() |
| 311 | 310 | ); |
| 312 | 311 | } |
| 313 | 312 | |
| 314 | - if ( is_null($this->dbHandler) ) { |
|
| 315 | - throw new Exception("Connection to ". $this->dbType . "failed"); |
|
| 313 | + if (is_null($this->dbHandler)) { |
|
| 314 | + throw new Exception("Connection to ".$this->dbType."failed"); |
|
| 316 | 315 | } |
| 317 | 316 | |
| 318 | 317 | $this->dbHandler->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_NATURAL); |
@@ -372,7 +371,7 @@ discard block |
||
| 372 | 371 | // This check will be removed once include-tables supports regexps |
| 373 | 372 | if (0 < count($this->dumpSettings['include-tables'])) { |
| 374 | 373 | $name = implode(",", $this->dumpSettings['include-tables']); |
| 375 | - throw new Exception("Table (" . $name . ") not found in database"); |
|
| 374 | + throw new Exception("Table (".$name.") not found in database"); |
|
| 376 | 375 | } |
| 377 | 376 | |
| 378 | 377 | $this->exportTables(); |
@@ -399,19 +398,19 @@ discard block |
||
| 399 | 398 | private function getDumpFileHeader() |
| 400 | 399 | { |
| 401 | 400 | $header = ''; |
| 402 | - if ( !$this->dumpSettings['skip-comments'] ) { |
|
| 401 | + if (!$this->dumpSettings['skip-comments']) { |
|
| 403 | 402 | // Some info about software, source and time |
| 404 | - $header = "-- mysqldump-php https://github.com/ifsnop/mysqldump-php" . PHP_EOL . |
|
| 405 | - "--" . PHP_EOL . |
|
| 406 | - "-- Host: {$this->host}\tDatabase: {$this->dbName}" . PHP_EOL . |
|
| 407 | - "-- ------------------------------------------------------" . PHP_EOL; |
|
| 403 | + $header = "-- mysqldump-php https://github.com/ifsnop/mysqldump-php".PHP_EOL. |
|
| 404 | + "--".PHP_EOL. |
|
| 405 | + "-- Host: {$this->host}\tDatabase: {$this->dbName}".PHP_EOL. |
|
| 406 | + "-- ------------------------------------------------------".PHP_EOL; |
|
| 408 | 407 | |
| 409 | - if ( !empty($this->version) ) { |
|
| 410 | - $header .= "-- Server version \t" . $this->version . PHP_EOL; |
|
| 408 | + if (!empty($this->version)) { |
|
| 409 | + $header .= "-- Server version \t".$this->version.PHP_EOL; |
|
| 411 | 410 | } |
| 412 | 411 | |
| 413 | - if ( !$this->dumpSettings['skip-dump-date'] ) { |
|
| 414 | - $header .= "-- Date: " . date('r') . PHP_EOL . PHP_EOL; |
|
| 412 | + if (!$this->dumpSettings['skip-dump-date']) { |
|
| 413 | + $header .= "-- Date: ".date('r').PHP_EOL.PHP_EOL; |
|
| 415 | 414 | } |
| 416 | 415 | } |
| 417 | 416 | return $header; |
@@ -428,7 +427,7 @@ discard block |
||
| 428 | 427 | if (!$this->dumpSettings['skip-comments']) { |
| 429 | 428 | $footer .= '-- Dump completed'; |
| 430 | 429 | if (!$this->dumpSettings['skip-dump-date']) { |
| 431 | - $footer .= ' on: ' . date('r'); |
|
| 430 | + $footer .= ' on: '.date('r'); |
|
| 432 | 431 | } |
| 433 | 432 | $footer .= PHP_EOL; |
| 434 | 433 | } |
@@ -516,10 +515,10 @@ discard block |
||
| 516 | 515 | $match = false; |
| 517 | 516 | |
| 518 | 517 | foreach ($arr as $pattern) { |
| 519 | - if ( '/' != $pattern[0] ) { |
|
| 518 | + if ('/' != $pattern[0]) { |
|
| 520 | 519 | continue; |
| 521 | 520 | } |
| 522 | - if ( 1 == preg_match($pattern, $table) ) { |
|
| 521 | + if (1 == preg_match($pattern, $table)) { |
|
| 523 | 522 | $match = true; |
| 524 | 523 | } |
| 525 | 524 | } |
@@ -536,14 +535,14 @@ discard block |
||
| 536 | 535 | { |
| 537 | 536 | // Exporting tables one by one |
| 538 | 537 | foreach ($this->tables as $table) { |
| 539 | - if ( $this->matches($table, $this->dumpSettings['exclude-tables']) ) { |
|
| 538 | + if ($this->matches($table, $this->dumpSettings['exclude-tables'])) { |
|
| 540 | 539 | continue; |
| 541 | 540 | } |
| 542 | 541 | $this->getTableStructure($table); |
| 543 | - if ( false === $this->dumpSettings['no-data'] ) { // don't break compatibility with old trigger |
|
| 542 | + if (false === $this->dumpSettings['no-data']) { // don't break compatibility with old trigger |
|
| 544 | 543 | $this->listValues($table); |
| 545 | - } else if ( true === $this->dumpSettings['no-data'] |
|
| 546 | - || $this->matches($table, $this->dumpSettings['no-data']) ) { |
|
| 544 | + } else if (true === $this->dumpSettings['no-data'] |
|
| 545 | + || $this->matches($table, $this->dumpSettings['no-data'])) { |
|
| 547 | 546 | continue; |
| 548 | 547 | } else { |
| 549 | 548 | $this->listValues($table); |
@@ -561,14 +560,14 @@ discard block |
||
| 561 | 560 | if (false === $this->dumpSettings['no-create-info']) { |
| 562 | 561 | // Exporting views one by one |
| 563 | 562 | foreach ($this->views as $view) { |
| 564 | - if ( $this->matches($view, $this->dumpSettings['exclude-tables']) ) { |
|
| 563 | + if ($this->matches($view, $this->dumpSettings['exclude-tables'])) { |
|
| 565 | 564 | continue; |
| 566 | 565 | } |
| 567 | 566 | $this->tableColumnTypes[$view] = $this->getTableColumnTypes($view); |
| 568 | 567 | $this->getViewStructureTable($view); |
| 569 | 568 | } |
| 570 | 569 | foreach ($this->views as $view) { |
| 571 | - if ( $this->matches($view, $this->dumpSettings['exclude-tables']) ) { |
|
| 570 | + if ($this->matches($view, $this->dumpSettings['exclude-tables'])) { |
|
| 572 | 571 | continue; |
| 573 | 572 | } |
| 574 | 573 | $this->getViewStructureView($view); |
@@ -627,9 +626,9 @@ discard block |
||
| 627 | 626 | if (!$this->dumpSettings['no-create-info']) { |
| 628 | 627 | $ret = ''; |
| 629 | 628 | if (!$this->dumpSettings['skip-comments']) { |
| 630 | - $ret = "--" . PHP_EOL . |
|
| 631 | - "-- Table structure for table `$tableName`" . PHP_EOL . |
|
| 632 | - "--" . PHP_EOL . PHP_EOL; |
|
| 629 | + $ret = "--".PHP_EOL. |
|
| 630 | + "-- Table structure for table `$tableName`".PHP_EOL. |
|
| 631 | + "--".PHP_EOL.PHP_EOL; |
|
| 633 | 632 | } |
| 634 | 633 | $stmt = $this->typeAdapter->show_create_table($tableName); |
| 635 | 634 | foreach ($this->dbHandler->query($stmt) as $r) { |
@@ -663,7 +662,7 @@ discard block |
||
| 663 | 662 | ); |
| 664 | 663 | $columns->setFetchMode(PDO::FETCH_ASSOC); |
| 665 | 664 | |
| 666 | - foreach($columns as $key => $col) { |
|
| 665 | + foreach ($columns as $key => $col) { |
|
| 667 | 666 | $types = $this->typeAdapter->parseColumnType($col); |
| 668 | 667 | $columnTypes[$col['Field']] = array( |
| 669 | 668 | 'is_numeric'=> $types['is_numeric'], |
@@ -687,9 +686,9 @@ discard block |
||
| 687 | 686 | private function getViewStructureTable($viewName) |
| 688 | 687 | { |
| 689 | 688 | if (!$this->dumpSettings['skip-comments']) { |
| 690 | - $ret = "--" . PHP_EOL . |
|
| 691 | - "-- Stand-In structure for view `${viewName}`" . PHP_EOL . |
|
| 692 | - "--" . PHP_EOL . PHP_EOL; |
|
| 689 | + $ret = "--".PHP_EOL. |
|
| 690 | + "-- Stand-In structure for view `${viewName}`".PHP_EOL. |
|
| 691 | + "--".PHP_EOL.PHP_EOL; |
|
| 693 | 692 | $this->compressManager->write($ret); |
| 694 | 693 | } |
| 695 | 694 | $stmt = $this->typeAdapter->show_create_view($viewName); |
@@ -718,13 +717,13 @@ discard block |
||
| 718 | 717 | */ |
| 719 | 718 | function createStandInTable($viewName) { |
| 720 | 719 | $ret = array(); |
| 721 | - foreach($this->tableColumnTypes[$viewName] as $k => $v) { |
|
| 720 | + foreach ($this->tableColumnTypes[$viewName] as $k => $v) { |
|
| 722 | 721 | $ret[] = "`${k}` ${v['type_sql']}"; |
| 723 | 722 | } |
| 724 | - $ret = implode(PHP_EOL . ",", $ret); |
|
| 723 | + $ret = implode(PHP_EOL.",", $ret); |
|
| 725 | 724 | |
| 726 | - $ret = "CREATE TABLE IF NOT EXISTS `$viewName` (" . |
|
| 727 | - PHP_EOL . $ret . PHP_EOL . ");" . PHP_EOL; |
|
| 725 | + $ret = "CREATE TABLE IF NOT EXISTS `$viewName` (". |
|
| 726 | + PHP_EOL.$ret.PHP_EOL.");".PHP_EOL; |
|
| 728 | 727 | |
| 729 | 728 | return $ret; |
| 730 | 729 | } |
@@ -739,9 +738,9 @@ discard block |
||
| 739 | 738 | private function getViewStructureView($viewName) |
| 740 | 739 | { |
| 741 | 740 | if (!$this->dumpSettings['skip-comments']) { |
| 742 | - $ret = "--" . PHP_EOL . |
|
| 743 | - "-- View structure for view `${viewName}`" . PHP_EOL . |
|
| 744 | - "--" . PHP_EOL . PHP_EOL; |
|
| 741 | + $ret = "--".PHP_EOL. |
|
| 742 | + "-- View structure for view `${viewName}`".PHP_EOL. |
|
| 743 | + "--".PHP_EOL.PHP_EOL; |
|
| 745 | 744 | $this->compressManager->write($ret); |
| 746 | 745 | } |
| 747 | 746 | $stmt = $this->typeAdapter->show_create_view($viewName); |
@@ -791,9 +790,9 @@ discard block |
||
| 791 | 790 | private function getProcedureStructure($procedureName) |
| 792 | 791 | { |
| 793 | 792 | if (!$this->dumpSettings['skip-comments']) { |
| 794 | - $ret = "--" . PHP_EOL . |
|
| 795 | - "-- Dumping routines for database '" . $this->dbName . "'" . PHP_EOL . |
|
| 796 | - "--" . PHP_EOL . PHP_EOL; |
|
| 793 | + $ret = "--".PHP_EOL. |
|
| 794 | + "-- Dumping routines for database '".$this->dbName."'".PHP_EOL. |
|
| 795 | + "--".PHP_EOL.PHP_EOL; |
|
| 797 | 796 | $this->compressManager->write($ret); |
| 798 | 797 | } |
| 799 | 798 | $stmt = $this->typeAdapter->show_create_procedure($procedureName); |
@@ -814,9 +813,9 @@ discard block |
||
| 814 | 813 | private function getEventStructure($eventName) |
| 815 | 814 | { |
| 816 | 815 | if (!$this->dumpSettings['skip-comments']) { |
| 817 | - $ret = "--" . PHP_EOL . |
|
| 818 | - "-- Dumping events for database '" . $this->dbName . "'" . PHP_EOL . |
|
| 819 | - "--" . PHP_EOL . PHP_EOL; |
|
| 816 | + $ret = "--".PHP_EOL. |
|
| 817 | + "-- Dumping events for database '".$this->dbName."'".PHP_EOL. |
|
| 818 | + "--".PHP_EOL.PHP_EOL; |
|
| 820 | 819 | $this->compressManager->write($ret); |
| 821 | 820 | } |
| 822 | 821 | $stmt = $this->typeAdapter->show_create_event($eventName); |
@@ -906,7 +905,7 @@ discard block |
||
| 906 | 905 | $lineSize = 0; |
| 907 | 906 | |
| 908 | 907 | $colStmt = $this->getColumnStmt($tableName); |
| 909 | - $stmt = "SELECT " . implode(",", $colStmt) . " FROM `$tableName`"; |
|
| 908 | + $stmt = "SELECT ".implode(",", $colStmt)." FROM `$tableName`"; |
|
| 910 | 909 | |
| 911 | 910 | if ($this->dumpSettings['where']) { |
| 912 | 911 | $stmt .= " WHERE {$this->dumpSettings['where']}"; |
@@ -920,29 +919,29 @@ discard block |
||
| 920 | 919 | |
| 921 | 920 | if ($this->dumpSettings['complete-insert']) { |
| 922 | 921 | $lineSize += $this->compressManager->write( |
| 923 | - "INSERT INTO `$tableName` (" . |
|
| 924 | - implode(", ", $colStmt) . |
|
| 925 | - ") VALUES (" . implode(",", $vals) . ")" |
|
| 922 | + "INSERT INTO `$tableName` (". |
|
| 923 | + implode(", ", $colStmt). |
|
| 924 | + ") VALUES (".implode(",", $vals).")" |
|
| 926 | 925 | ); |
| 927 | 926 | } else { |
| 928 | 927 | $lineSize += $this->compressManager->write( |
| 929 | - "INSERT INTO `$tableName` VALUES (" . implode(",", $vals) . ")" |
|
| 928 | + "INSERT INTO `$tableName` VALUES (".implode(",", $vals).")" |
|
| 930 | 929 | ); |
| 931 | 930 | } |
| 932 | 931 | $onlyOnce = false; |
| 933 | 932 | } else { |
| 934 | - $lineSize += $this->compressManager->write(",(" . implode(",", $vals) . ")"); |
|
| 933 | + $lineSize += $this->compressManager->write(",(".implode(",", $vals).")"); |
|
| 935 | 934 | } |
| 936 | 935 | if (($lineSize > $this->dumpSettings['net_buffer_length']) || |
| 937 | 936 | !$this->dumpSettings['extended-insert']) { |
| 938 | 937 | $onlyOnce = true; |
| 939 | - $lineSize = $this->compressManager->write(";" . PHP_EOL); |
|
| 938 | + $lineSize = $this->compressManager->write(";".PHP_EOL); |
|
| 940 | 939 | } |
| 941 | 940 | } |
| 942 | 941 | $resultSet->closeCursor(); |
| 943 | 942 | |
| 944 | 943 | if (!$onlyOnce) { |
| 945 | - $this->compressManager->write(";" . PHP_EOL); |
|
| 944 | + $this->compressManager->write(";".PHP_EOL); |
|
| 946 | 945 | } |
| 947 | 946 | |
| 948 | 947 | $this->endListValues($tableName); |
@@ -959,9 +958,9 @@ discard block |
||
| 959 | 958 | { |
| 960 | 959 | if (!$this->dumpSettings['skip-comments']) { |
| 961 | 960 | $this->compressManager->write( |
| 962 | - "--" . PHP_EOL . |
|
| 963 | - "-- Dumping data for table `$tableName`" . PHP_EOL . |
|
| 964 | - "--" . PHP_EOL . PHP_EOL |
|
| 961 | + "--".PHP_EOL. |
|
| 962 | + "-- Dumping data for table `$tableName`".PHP_EOL. |
|
| 963 | + "--".PHP_EOL.PHP_EOL |
|
| 965 | 964 | ); |
| 966 | 965 | } |
| 967 | 966 | |
@@ -1047,7 +1046,7 @@ discard block |
||
| 1047 | 1046 | function getColumnStmt($tableName) |
| 1048 | 1047 | { |
| 1049 | 1048 | $colStmt = array(); |
| 1050 | - foreach($this->tableColumnTypes[$tableName] as $colName => $colType) { |
|
| 1049 | + foreach ($this->tableColumnTypes[$tableName] as $colName => $colType) { |
|
| 1051 | 1050 | if ($colType['type'] == 'bit' && $this->dumpSettings['hex-blob']) { |
| 1052 | 1051 | $colStmt[] = "LPAD(HEX(`${colName}`),2,'0') AS `${colName}`"; |
| 1053 | 1052 | } else if ($colType['is_blob'] && $this->dumpSettings['hex-blob']) { |
@@ -1095,11 +1094,11 @@ discard block |
||
| 1095 | 1094 | public static function create($c) |
| 1096 | 1095 | { |
| 1097 | 1096 | $c = ucfirst(strtolower($c)); |
| 1098 | - if (! CompressMethod::isValid($c)) { |
|
| 1097 | + if (!CompressMethod::isValid($c)) { |
|
| 1099 | 1098 | throw new Exception("Compression method ($c) is not defined yet"); |
| 1100 | 1099 | } |
| 1101 | 1100 | |
| 1102 | - $method = __NAMESPACE__ . "\\" . "Compress" . $c; |
|
| 1101 | + $method = __NAMESPACE__."\\"."Compress".$c; |
|
| 1103 | 1102 | |
| 1104 | 1103 | return new $method; |
| 1105 | 1104 | } |
@@ -1111,7 +1110,7 @@ discard block |
||
| 1111 | 1110 | |
| 1112 | 1111 | public function __construct() |
| 1113 | 1112 | { |
| 1114 | - if (! function_exists("bzopen")) { |
|
| 1113 | + if (!function_exists("bzopen")) { |
|
| 1115 | 1114 | throw new Exception("Compression is enabled, but bzip2 lib is not installed or configured properly"); |
| 1116 | 1115 | } |
| 1117 | 1116 | } |
@@ -1149,7 +1148,7 @@ discard block |
||
| 1149 | 1148 | |
| 1150 | 1149 | public function __construct() |
| 1151 | 1150 | { |
| 1152 | - if (! function_exists("gzopen")) { |
|
| 1151 | + if (!function_exists("gzopen")) { |
|
| 1153 | 1152 | throw new Exception("Compression is enabled, but gzip lib is not installed or configured properly"); |
| 1154 | 1153 | } |
| 1155 | 1154 | } |
@@ -1249,10 +1248,10 @@ discard block |
||
| 1249 | 1248 | public static function create($c, $dbHandler = null, $dumpSettings = array()) |
| 1250 | 1249 | { |
| 1251 | 1250 | $c = ucfirst(strtolower($c)); |
| 1252 | - if (! TypeAdapter::isValid($c)) { |
|
| 1251 | + if (!TypeAdapter::isValid($c)) { |
|
| 1253 | 1252 | throw new Exception("Database type support for ($c) not yet available"); |
| 1254 | 1253 | } |
| 1255 | - $method = __NAMESPACE__ . "\\" . "TypeAdapter" . $c; |
|
| 1254 | + $method = __NAMESPACE__."\\"."TypeAdapter".$c; |
|
| 1256 | 1255 | return new $method($dbHandler, $dumpSettings); |
| 1257 | 1256 | } |
| 1258 | 1257 | |
@@ -1273,8 +1272,8 @@ discard block |
||
| 1273 | 1272 | |
| 1274 | 1273 | public function show_create_table($tableName) |
| 1275 | 1274 | { |
| 1276 | - return "SELECT tbl_name as 'Table', sql as 'Create Table' " . |
|
| 1277 | - "FROM sqlite_master " . |
|
| 1275 | + return "SELECT tbl_name as 'Table', sql as 'Create Table' ". |
|
| 1276 | + "FROM sqlite_master ". |
|
| 1278 | 1277 | "WHERE type='table' AND tbl_name='$tableName'"; |
| 1279 | 1278 | } |
| 1280 | 1279 | |
@@ -1289,8 +1288,8 @@ discard block |
||
| 1289 | 1288 | |
| 1290 | 1289 | public function show_create_view($viewName) |
| 1291 | 1290 | { |
| 1292 | - return "SELECT tbl_name as 'View', sql as 'Create View' " . |
|
| 1293 | - "FROM sqlite_master " . |
|
| 1291 | + return "SELECT tbl_name as 'View', sql as 'Create View' ". |
|
| 1292 | + "FROM sqlite_master ". |
|
| 1294 | 1293 | "WHERE type='view' AND tbl_name='$viewName'"; |
| 1295 | 1294 | } |
| 1296 | 1295 | |
@@ -1532,9 +1531,9 @@ discard block |
||
| 1532 | 1531 | $ret = ""; |
| 1533 | 1532 | |
| 1534 | 1533 | $ret .= "CREATE DATABASE /*!32312 IF NOT EXISTS*/ `${databaseName}`". |
| 1535 | - " /*!40100 DEFAULT CHARACTER SET ${characterSet} " . |
|
| 1536 | - " COLLATE ${collationDb} */;" . PHP_EOL . PHP_EOL . |
|
| 1537 | - "USE `${databaseName}`;" . PHP_EOL . PHP_EOL; |
|
| 1534 | + " /*!40100 DEFAULT CHARACTER SET ${characterSet} ". |
|
| 1535 | + " COLLATE ${collationDb} */;".PHP_EOL.PHP_EOL. |
|
| 1536 | + "USE `${databaseName}`;".PHP_EOL.PHP_EOL; |
|
| 1538 | 1537 | |
| 1539 | 1538 | return $ret; |
| 1540 | 1539 | } |
@@ -1564,23 +1563,23 @@ discard block |
||
| 1564 | 1563 | return "SHOW CREATE EVENT `$eventName`"; |
| 1565 | 1564 | } |
| 1566 | 1565 | |
| 1567 | - public function create_table( $row) |
|
| 1566 | + public function create_table($row) |
|
| 1568 | 1567 | { |
| 1569 | - if ( !isset($row['Create Table']) ) { |
|
| 1568 | + if (!isset($row['Create Table'])) { |
|
| 1570 | 1569 | throw new Exception("Error getting table code, unknown output"); |
| 1571 | 1570 | } |
| 1572 | 1571 | |
| 1573 | 1572 | $createTable = $row['Create Table']; |
| 1574 | - if ( $this->dumpSettings['reset-auto-increment'] ) { |
|
| 1573 | + if ($this->dumpSettings['reset-auto-increment']) { |
|
| 1575 | 1574 | $match = "/AUTO_INCREMENT=[0-9]+/s"; |
| 1576 | 1575 | $replace = ""; |
| 1577 | 1576 | $createTable = preg_replace($match, $replace, $createTable); |
| 1578 | 1577 | } |
| 1579 | 1578 | |
| 1580 | - $ret = "/*!40101 SET @saved_cs_client = @@character_set_client */;" . PHP_EOL . |
|
| 1581 | - "/*!40101 SET character_set_client = " . $this->dumpSettings['default-character-set'] . " */;" . PHP_EOL . |
|
| 1582 | - $createTable . ";" . PHP_EOL . |
|
| 1583 | - "/*!40101 SET character_set_client = @saved_cs_client */;" . PHP_EOL . |
|
| 1579 | + $ret = "/*!40101 SET @saved_cs_client = @@character_set_client */;".PHP_EOL. |
|
| 1580 | + "/*!40101 SET character_set_client = ".$this->dumpSettings['default-character-set']." */;".PHP_EOL. |
|
| 1581 | + $createTable.";".PHP_EOL. |
|
| 1582 | + "/*!40101 SET character_set_client = @saved_cs_client */;".PHP_EOL. |
|
| 1584 | 1583 | PHP_EOL; |
| 1585 | 1584 | return $ret; |
| 1586 | 1585 | } |
@@ -1606,7 +1605,7 @@ discard block |
||
| 1606 | 1605 | $viewStmt = $viewStmtReplaced; |
| 1607 | 1606 | }; |
| 1608 | 1607 | |
| 1609 | - $ret .= $viewStmt . ';' . PHP_EOL . PHP_EOL; |
|
| 1608 | + $ret .= $viewStmt.';'.PHP_EOL.PHP_EOL; |
|
| 1610 | 1609 | return $ret; |
| 1611 | 1610 | } |
| 1612 | 1611 | |
@@ -1628,9 +1627,9 @@ discard block |
||
| 1628 | 1627 | $triggerStmt = $triggerStmtReplaced; |
| 1629 | 1628 | } |
| 1630 | 1629 | |
| 1631 | - $ret .= "DELIMITER ;;" . PHP_EOL . |
|
| 1632 | - $triggerStmt . ";;" . PHP_EOL . |
|
| 1633 | - "DELIMITER ;" . PHP_EOL . PHP_EOL; |
|
| 1630 | + $ret .= "DELIMITER ;;".PHP_EOL. |
|
| 1631 | + $triggerStmt.";;".PHP_EOL. |
|
| 1632 | + "DELIMITER ;".PHP_EOL.PHP_EOL; |
|
| 1634 | 1633 | return $ret; |
| 1635 | 1634 | } |
| 1636 | 1635 | |
@@ -1638,19 +1637,19 @@ discard block |
||
| 1638 | 1637 | { |
| 1639 | 1638 | $ret = ""; |
| 1640 | 1639 | if (!isset($row['Create Procedure'])) { |
| 1641 | - throw new Exception("Error getting procedure code, unknown output. " . |
|
| 1640 | + throw new Exception("Error getting procedure code, unknown output. ". |
|
| 1642 | 1641 | "Please check 'https://bugs.mysql.com/bug.php?id=14564'"); |
| 1643 | 1642 | } |
| 1644 | 1643 | $procedureStmt = $row['Create Procedure']; |
| 1645 | 1644 | |
| 1646 | - $ret .= "/*!50003 DROP PROCEDURE IF EXISTS `" . |
|
| 1647 | - $row['Procedure'] . "` */;" . PHP_EOL . |
|
| 1648 | - "/*!40101 SET @saved_cs_client = @@character_set_client */;" . PHP_EOL . |
|
| 1649 | - "/*!40101 SET character_set_client = " . $this->dumpSettings['default-character-set'] . " */;" . PHP_EOL . |
|
| 1650 | - "DELIMITER ;;" . PHP_EOL . |
|
| 1651 | - $procedureStmt . " ;;" . PHP_EOL . |
|
| 1652 | - "DELIMITER ;" . PHP_EOL . |
|
| 1653 | - "/*!40101 SET character_set_client = @saved_cs_client */;" . PHP_EOL . PHP_EOL; |
|
| 1645 | + $ret .= "/*!50003 DROP PROCEDURE IF EXISTS `". |
|
| 1646 | + $row['Procedure']."` */;".PHP_EOL. |
|
| 1647 | + "/*!40101 SET @saved_cs_client = @@character_set_client */;".PHP_EOL. |
|
| 1648 | + "/*!40101 SET character_set_client = ".$this->dumpSettings['default-character-set']." */;".PHP_EOL. |
|
| 1649 | + "DELIMITER ;;".PHP_EOL. |
|
| 1650 | + $procedureStmt." ;;".PHP_EOL. |
|
| 1651 | + "DELIMITER ;".PHP_EOL. |
|
| 1652 | + "/*!40101 SET character_set_client = @saved_cs_client */;".PHP_EOL.PHP_EOL; |
|
| 1654 | 1653 | |
| 1655 | 1654 | return $ret; |
| 1656 | 1655 | } |
@@ -1658,8 +1657,8 @@ discard block |
||
| 1658 | 1657 | public function create_event($row) |
| 1659 | 1658 | { |
| 1660 | 1659 | $ret = ""; |
| 1661 | - if ( !isset($row['Create Event']) ) { |
|
| 1662 | - throw new Exception("Error getting event code, unknown output. " . |
|
| 1660 | + if (!isset($row['Create Event'])) { |
|
| 1661 | + throw new Exception("Error getting event code, unknown output. ". |
|
| 1663 | 1662 | "Please check 'http://stackoverflow.com/questions/10853826/mysql-5-5-create-event-gives-syntax-error'"); |
| 1664 | 1663 | } |
| 1665 | 1664 | $eventName = $row['Event']; |
@@ -1676,27 +1675,27 @@ discard block |
||
| 1676 | 1675 | $eventStmt = $eventStmtReplaced; |
| 1677 | 1676 | } |
| 1678 | 1677 | |
| 1679 | - $ret .= "/*!50106 SET @save_time_zone= @@TIME_ZONE */ ;" . PHP_EOL . |
|
| 1680 | - "/*!50106 DROP EVENT IF EXISTS `" . $eventName . "` */;" . PHP_EOL . |
|
| 1681 | - "DELIMITER ;;" . PHP_EOL . |
|
| 1682 | - "/*!50003 SET @saved_cs_client = @@character_set_client */ ;;" . PHP_EOL . |
|
| 1683 | - "/*!50003 SET @saved_cs_results = @@character_set_results */ ;;" . PHP_EOL . |
|
| 1684 | - "/*!50003 SET @saved_col_connection = @@collation_connection */ ;;" . PHP_EOL . |
|
| 1685 | - "/*!50003 SET character_set_client = utf8 */ ;;" . PHP_EOL . |
|
| 1686 | - "/*!50003 SET character_set_results = utf8 */ ;;" . PHP_EOL . |
|
| 1687 | - "/*!50003 SET collation_connection = utf8_general_ci */ ;;" . PHP_EOL . |
|
| 1688 | - "/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;" . PHP_EOL . |
|
| 1689 | - "/*!50003 SET sql_mode = '" . $sqlMode . "' */ ;;" . PHP_EOL . |
|
| 1690 | - "/*!50003 SET @saved_time_zone = @@time_zone */ ;;" . PHP_EOL . |
|
| 1691 | - "/*!50003 SET time_zone = 'SYSTEM' */ ;;" . PHP_EOL . |
|
| 1692 | - $eventStmt . " ;;" . PHP_EOL . |
|
| 1693 | - "/*!50003 SET time_zone = @saved_time_zone */ ;;" . PHP_EOL . |
|
| 1694 | - "/*!50003 SET sql_mode = @saved_sql_mode */ ;;" . PHP_EOL . |
|
| 1695 | - "/*!50003 SET character_set_client = @saved_cs_client */ ;;" . PHP_EOL . |
|
| 1696 | - "/*!50003 SET character_set_results = @saved_cs_results */ ;;" . PHP_EOL . |
|
| 1697 | - "/*!50003 SET collation_connection = @saved_col_connection */ ;;" . PHP_EOL . |
|
| 1698 | - "DELIMITER ;" . PHP_EOL . |
|
| 1699 | - "/*!50106 SET TIME_ZONE= @save_time_zone */ ;" . PHP_EOL . PHP_EOL; |
|
| 1678 | + $ret .= "/*!50106 SET @save_time_zone= @@TIME_ZONE */ ;".PHP_EOL. |
|
| 1679 | + "/*!50106 DROP EVENT IF EXISTS `".$eventName."` */;".PHP_EOL. |
|
| 1680 | + "DELIMITER ;;".PHP_EOL. |
|
| 1681 | + "/*!50003 SET @saved_cs_client = @@character_set_client */ ;;".PHP_EOL. |
|
| 1682 | + "/*!50003 SET @saved_cs_results = @@character_set_results */ ;;".PHP_EOL. |
|
| 1683 | + "/*!50003 SET @saved_col_connection = @@collation_connection */ ;;".PHP_EOL. |
|
| 1684 | + "/*!50003 SET character_set_client = utf8 */ ;;".PHP_EOL. |
|
| 1685 | + "/*!50003 SET character_set_results = utf8 */ ;;".PHP_EOL. |
|
| 1686 | + "/*!50003 SET collation_connection = utf8_general_ci */ ;;".PHP_EOL. |
|
| 1687 | + "/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;".PHP_EOL. |
|
| 1688 | + "/*!50003 SET sql_mode = '".$sqlMode."' */ ;;".PHP_EOL. |
|
| 1689 | + "/*!50003 SET @saved_time_zone = @@time_zone */ ;;".PHP_EOL. |
|
| 1690 | + "/*!50003 SET time_zone = 'SYSTEM' */ ;;".PHP_EOL. |
|
| 1691 | + $eventStmt." ;;".PHP_EOL. |
|
| 1692 | + "/*!50003 SET time_zone = @saved_time_zone */ ;;".PHP_EOL. |
|
| 1693 | + "/*!50003 SET sql_mode = @saved_sql_mode */ ;;".PHP_EOL. |
|
| 1694 | + "/*!50003 SET character_set_client = @saved_cs_client */ ;;".PHP_EOL. |
|
| 1695 | + "/*!50003 SET character_set_results = @saved_cs_results */ ;;".PHP_EOL. |
|
| 1696 | + "/*!50003 SET collation_connection = @saved_col_connection */ ;;".PHP_EOL. |
|
| 1697 | + "DELIMITER ;".PHP_EOL. |
|
| 1698 | + "/*!50106 SET TIME_ZONE= @save_time_zone */ ;".PHP_EOL.PHP_EOL; |
|
| 1700 | 1699 | // Commented because we are doing this in restore_parameters() |
| 1701 | 1700 | // "/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;" . PHP_EOL . PHP_EOL; |
| 1702 | 1701 | |
@@ -1707,8 +1706,8 @@ discard block |
||
| 1707 | 1706 | { |
| 1708 | 1707 | $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__); |
| 1709 | 1708 | $args = func_get_args(); |
| 1710 | - return "SELECT TABLE_NAME AS tbl_name " . |
|
| 1711 | - "FROM INFORMATION_SCHEMA.TABLES " . |
|
| 1709 | + return "SELECT TABLE_NAME AS tbl_name ". |
|
| 1710 | + "FROM INFORMATION_SCHEMA.TABLES ". |
|
| 1712 | 1711 | "WHERE TABLE_TYPE='BASE TABLE' AND TABLE_SCHEMA='${args[0]}'"; |
| 1713 | 1712 | } |
| 1714 | 1713 | |
@@ -1716,8 +1715,8 @@ discard block |
||
| 1716 | 1715 | { |
| 1717 | 1716 | $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__); |
| 1718 | 1717 | $args = func_get_args(); |
| 1719 | - return "SELECT TABLE_NAME AS tbl_name " . |
|
| 1720 | - "FROM INFORMATION_SCHEMA.TABLES " . |
|
| 1718 | + return "SELECT TABLE_NAME AS tbl_name ". |
|
| 1719 | + "FROM INFORMATION_SCHEMA.TABLES ". |
|
| 1721 | 1720 | "WHERE TABLE_TYPE='VIEW' AND TABLE_SCHEMA='${args[0]}'"; |
| 1722 | 1721 | } |
| 1723 | 1722 | |
@@ -1739,8 +1738,8 @@ discard block |
||
| 1739 | 1738 | { |
| 1740 | 1739 | $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__); |
| 1741 | 1740 | $args = func_get_args(); |
| 1742 | - return "SELECT SPECIFIC_NAME AS procedure_name " . |
|
| 1743 | - "FROM INFORMATION_SCHEMA.ROUTINES " . |
|
| 1741 | + return "SELECT SPECIFIC_NAME AS procedure_name ". |
|
| 1742 | + "FROM INFORMATION_SCHEMA.ROUTINES ". |
|
| 1744 | 1743 | "WHERE ROUTINE_TYPE='PROCEDURE' AND ROUTINE_SCHEMA='${args[0]}'"; |
| 1745 | 1744 | } |
| 1746 | 1745 | |
@@ -1754,8 +1753,8 @@ discard block |
||
| 1754 | 1753 | { |
| 1755 | 1754 | $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__); |
| 1756 | 1755 | $args = func_get_args(); |
| 1757 | - return "SELECT EVENT_NAME AS event_name " . |
|
| 1758 | - "FROM INFORMATION_SCHEMA.EVENTS " . |
|
| 1756 | + return "SELECT EVENT_NAME AS event_name ". |
|
| 1757 | + "FROM INFORMATION_SCHEMA.EVENTS ". |
|
| 1759 | 1758 | "WHERE EVENT_SCHEMA='${args[0]}'"; |
| 1760 | 1759 | } |
| 1761 | 1760 | |
@@ -1791,19 +1790,19 @@ discard block |
||
| 1791 | 1790 | { |
| 1792 | 1791 | $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__); |
| 1793 | 1792 | $args = func_get_args(); |
| 1794 | - return "LOCK TABLES `${args[0]}` WRITE;" . PHP_EOL; |
|
| 1793 | + return "LOCK TABLES `${args[0]}` WRITE;".PHP_EOL; |
|
| 1795 | 1794 | } |
| 1796 | 1795 | |
| 1797 | 1796 | public function end_add_lock_table() |
| 1798 | 1797 | { |
| 1799 | - return "UNLOCK TABLES;" . PHP_EOL; |
|
| 1798 | + return "UNLOCK TABLES;".PHP_EOL; |
|
| 1800 | 1799 | } |
| 1801 | 1800 | |
| 1802 | 1801 | public function start_add_disable_keys() |
| 1803 | 1802 | { |
| 1804 | 1803 | $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__); |
| 1805 | 1804 | $args = func_get_args(); |
| 1806 | - return "/*!40000 ALTER TABLE `${args[0]}` DISABLE KEYS */;" . |
|
| 1805 | + return "/*!40000 ALTER TABLE `${args[0]}` DISABLE KEYS */;". |
|
| 1807 | 1806 | PHP_EOL; |
| 1808 | 1807 | } |
| 1809 | 1808 | |
@@ -1811,57 +1810,57 @@ discard block |
||
| 1811 | 1810 | { |
| 1812 | 1811 | $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__); |
| 1813 | 1812 | $args = func_get_args(); |
| 1814 | - return "/*!40000 ALTER TABLE `${args[0]}` ENABLE KEYS */;" . |
|
| 1813 | + return "/*!40000 ALTER TABLE `${args[0]}` ENABLE KEYS */;". |
|
| 1815 | 1814 | PHP_EOL; |
| 1816 | 1815 | } |
| 1817 | 1816 | |
| 1818 | 1817 | public function start_disable_autocommit() |
| 1819 | 1818 | { |
| 1820 | - return "SET autocommit=0;" . PHP_EOL; |
|
| 1819 | + return "SET autocommit=0;".PHP_EOL; |
|
| 1821 | 1820 | } |
| 1822 | 1821 | |
| 1823 | 1822 | public function end_disable_autocommit() |
| 1824 | 1823 | { |
| 1825 | - return "COMMIT;" . PHP_EOL; |
|
| 1824 | + return "COMMIT;".PHP_EOL; |
|
| 1826 | 1825 | } |
| 1827 | 1826 | |
| 1828 | 1827 | public function add_drop_database() |
| 1829 | 1828 | { |
| 1830 | 1829 | $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__); |
| 1831 | 1830 | $args = func_get_args(); |
| 1832 | - return "/*!40000 DROP DATABASE IF EXISTS `${args[0]}`*/;" . |
|
| 1833 | - PHP_EOL . PHP_EOL; |
|
| 1831 | + return "/*!40000 DROP DATABASE IF EXISTS `${args[0]}`*/;". |
|
| 1832 | + PHP_EOL.PHP_EOL; |
|
| 1834 | 1833 | } |
| 1835 | 1834 | |
| 1836 | 1835 | public function add_drop_trigger() |
| 1837 | 1836 | { |
| 1838 | 1837 | $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__); |
| 1839 | 1838 | $args = func_get_args(); |
| 1840 | - return "DROP TRIGGER IF EXISTS `${args[0]}`;" . PHP_EOL; |
|
| 1839 | + return "DROP TRIGGER IF EXISTS `${args[0]}`;".PHP_EOL; |
|
| 1841 | 1840 | } |
| 1842 | 1841 | |
| 1843 | 1842 | public function drop_table() |
| 1844 | 1843 | { |
| 1845 | 1844 | $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__); |
| 1846 | 1845 | $args = func_get_args(); |
| 1847 | - return "DROP TABLE IF EXISTS `${args[0]}`;" . PHP_EOL; |
|
| 1846 | + return "DROP TABLE IF EXISTS `${args[0]}`;".PHP_EOL; |
|
| 1848 | 1847 | } |
| 1849 | 1848 | |
| 1850 | 1849 | public function drop_view() |
| 1851 | 1850 | { |
| 1852 | 1851 | $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__); |
| 1853 | 1852 | $args = func_get_args(); |
| 1854 | - return "DROP TABLE IF EXISTS `${args[0]}`;" . PHP_EOL . |
|
| 1855 | - "/*!50001 DROP VIEW IF EXISTS `${args[0]}`*/;" . PHP_EOL; |
|
| 1853 | + return "DROP TABLE IF EXISTS `${args[0]}`;".PHP_EOL. |
|
| 1854 | + "/*!50001 DROP VIEW IF EXISTS `${args[0]}`*/;".PHP_EOL; |
|
| 1856 | 1855 | } |
| 1857 | 1856 | |
| 1858 | 1857 | public function getDatabaseHeader() |
| 1859 | 1858 | { |
| 1860 | 1859 | $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__); |
| 1861 | 1860 | $args = func_get_args(); |
| 1862 | - return "--" . PHP_EOL . |
|
| 1863 | - "-- Current Database: `${args[0]}`" . PHP_EOL . |
|
| 1864 | - "--" . PHP_EOL . PHP_EOL; |
|
| 1861 | + return "--".PHP_EOL. |
|
| 1862 | + "-- Current Database: `${args[0]}`".PHP_EOL. |
|
| 1863 | + "--".PHP_EOL.PHP_EOL; |
|
| 1865 | 1864 | } |
| 1866 | 1865 | |
| 1867 | 1866 | /** |
@@ -1876,9 +1875,9 @@ discard block |
||
| 1876 | 1875 | $colInfo = array(); |
| 1877 | 1876 | $colParts = explode(" ", $colType['Type']); |
| 1878 | 1877 | |
| 1879 | - if($fparen = strpos($colParts[0], "(")) { |
|
| 1878 | + if ($fparen = strpos($colParts[0], "(")) { |
|
| 1880 | 1879 | $colInfo['type'] = substr($colParts[0], 0, $fparen); |
| 1881 | - $colInfo['length'] = str_replace(")", "", substr($colParts[0], $fparen+1)); |
|
| 1880 | + $colInfo['length'] = str_replace(")", "", substr($colParts[0], $fparen + 1)); |
|
| 1882 | 1881 | $colInfo['attributes'] = isset($colParts[1]) ? $colParts[1] : NULL; |
| 1883 | 1882 | } else { |
| 1884 | 1883 | $colInfo['type'] = $colParts[0]; |
@@ -1895,20 +1894,20 @@ discard block |
||
| 1895 | 1894 | |
| 1896 | 1895 | public function backup_parameters() |
| 1897 | 1896 | { |
| 1898 | - $ret = "/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;" . PHP_EOL . |
|
| 1899 | - "/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;" . PHP_EOL . |
|
| 1900 | - "/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;" . PHP_EOL . |
|
| 1901 | - "/*!40101 SET NAMES " . $this->dumpSettings['default-character-set'] . " */;" . PHP_EOL; |
|
| 1897 | + $ret = "/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;".PHP_EOL. |
|
| 1898 | + "/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;".PHP_EOL. |
|
| 1899 | + "/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;".PHP_EOL. |
|
| 1900 | + "/*!40101 SET NAMES ".$this->dumpSettings['default-character-set']." */;".PHP_EOL; |
|
| 1902 | 1901 | |
| 1903 | 1902 | if (false === $this->dumpSettings['skip-tz-utc']) { |
| 1904 | - $ret .= "/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;" . PHP_EOL . |
|
| 1905 | - "/*!40103 SET TIME_ZONE='+00:00' */;" . PHP_EOL; |
|
| 1903 | + $ret .= "/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;".PHP_EOL. |
|
| 1904 | + "/*!40103 SET TIME_ZONE='+00:00' */;".PHP_EOL; |
|
| 1906 | 1905 | } |
| 1907 | 1906 | |
| 1908 | - $ret .= "/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;" . PHP_EOL . |
|
| 1909 | - "/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;" . PHP_EOL . |
|
| 1910 | - "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;" . PHP_EOL . |
|
| 1911 | - "/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;" . PHP_EOL .PHP_EOL; |
|
| 1907 | + $ret .= "/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;".PHP_EOL. |
|
| 1908 | + "/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;".PHP_EOL. |
|
| 1909 | + "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;".PHP_EOL. |
|
| 1910 | + "/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;".PHP_EOL.PHP_EOL; |
|
| 1912 | 1911 | |
| 1913 | 1912 | return $ret; |
| 1914 | 1913 | } |
@@ -1918,16 +1917,16 @@ discard block |
||
| 1918 | 1917 | $ret = ""; |
| 1919 | 1918 | |
| 1920 | 1919 | if (false === $this->dumpSettings['skip-tz-utc']) { |
| 1921 | - $ret .= "/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;" . PHP_EOL; |
|
| 1920 | + $ret .= "/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;".PHP_EOL; |
|
| 1922 | 1921 | } |
| 1923 | 1922 | |
| 1924 | - $ret .= "/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;" . PHP_EOL . |
|
| 1925 | - "/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;" . PHP_EOL . |
|
| 1926 | - "/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;" . PHP_EOL . |
|
| 1927 | - "/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;" . PHP_EOL . |
|
| 1928 | - "/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;" . PHP_EOL . |
|
| 1929 | - "/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;" . PHP_EOL . |
|
| 1930 | - "/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;" . PHP_EOL . PHP_EOL; |
|
| 1923 | + $ret .= "/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;".PHP_EOL. |
|
| 1924 | + "/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;".PHP_EOL. |
|
| 1925 | + "/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;".PHP_EOL. |
|
| 1926 | + "/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;".PHP_EOL. |
|
| 1927 | + "/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;".PHP_EOL. |
|
| 1928 | + "/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;".PHP_EOL. |
|
| 1929 | + "/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;".PHP_EOL.PHP_EOL; |
|
| 1931 | 1930 | |
| 1932 | 1931 | return $ret; |
| 1933 | 1932 | } |
@@ -1942,7 +1941,7 @@ discard block |
||
| 1942 | 1941 | */ |
| 1943 | 1942 | private function check_parameters($num_args, $expected_num_args, $method_name) |
| 1944 | 1943 | { |
| 1945 | - if ( $num_args != $expected_num_args ) { |
|
| 1944 | + if ($num_args != $expected_num_args) { |
|
| 1946 | 1945 | throw new Exception("Unexpected parameter passed to $method_name"); |
| 1947 | 1946 | } |
| 1948 | 1947 | return; |