| @@ -158,26 +158,26 @@ 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 | 167 | |
| 168 | - $this->dumpSettings['init_commands'][] = "SET NAMES " . $this->dumpSettings['default-character-set']; | |
| 168 | + $this->dumpSettings['init_commands'][] = "SET NAMES ".$this->dumpSettings['default-character-set']; | |
| 169 | 169 | |
| 170 | 170 |          if (false === $this->dumpSettings['skip-tz-utc']) { | 
| 171 | 171 | $this->dumpSettings['init_commands'][] = "SET TIME_ZONE='+00:00'"; | 
| 172 | 172 | } | 
| 173 | 173 | |
| 174 | 174 | $diff = array_diff(array_keys($this->dumpSettings), array_keys($dumpSettingsDefault)); | 
| 175 | -        if (count($diff)>0) { | |
| 176 | -            throw new Exception("Unexpected value in dumpSettings: (" . implode(",", $diff) . ")"); | |
| 175 | +        if (count($diff) > 0) { | |
| 176 | +            throw new Exception("Unexpected value in dumpSettings: (".implode(",", $diff).")"); | |
| 177 | 177 | } | 
| 178 | 178 | |
| 179 | - if ( !is_array($this->dumpSettings['include-tables']) || | |
| 180 | -            !is_array($this->dumpSettings['exclude-tables']) ) { | |
| 179 | + if (!is_array($this->dumpSettings['include-tables']) || | |
| 180 | +            !is_array($this->dumpSettings['exclude-tables'])) { | |
| 181 | 181 |              throw new Exception("Include-tables and exclude-tables should be arrays"); | 
| 182 | 182 | } | 
| 183 | 183 | |
| @@ -246,7 +246,7 @@ discard block | ||
| 246 | 246 | |
| 247 | 247 | $dsn = substr($dsn, $pos + 1); | 
| 248 | 248 | |
| 249 | -        foreach(explode(";", $dsn) as $kvp) { | |
| 249 | +        foreach (explode(";", $dsn) as $kvp) { | |
| 250 | 250 |              $kvpArr = explode("=", $kvp); | 
| 251 | 251 | $this->dsnArray[strtolower($kvpArr[0])] = $kvpArr[1]; | 
| 252 | 252 | } | 
| @@ -256,8 +256,7 @@ discard block | ||
| 256 | 256 |              throw new Exception("Missing host from DSN string"); | 
| 257 | 257 | } | 
| 258 | 258 | $this->host = (!empty($this->dsnArray['host'])) ? | 
| 259 | - $this->dsnArray['host'] : | |
| 260 | - $this->dsnArray['unix_socket']; | |
| 259 | + $this->dsnArray['host'] : $this->dsnArray['unix_socket']; | |
| 261 | 260 | |
| 262 | 261 |          if (empty($this->dsnArray['dbname'])) { | 
| 263 | 262 |              throw new Exception("Missing database name from DSN string"); | 
| @@ -279,7 +278,7 @@ discard block | ||
| 279 | 278 |          try { | 
| 280 | 279 |              switch ($this->dbType) { | 
| 281 | 280 | case 'sqlite': | 
| 282 | -                    $this->dbHandler = @new PDO("sqlite:" . $this->dbName, null, null, $this->pdoSettings); | |
| 281 | +                    $this->dbHandler = @new PDO("sqlite:".$this->dbName, null, null, $this->pdoSettings); | |
| 283 | 282 | break; | 
| 284 | 283 | case 'mysql': | 
| 285 | 284 | case 'pgsql': | 
| @@ -291,24 +290,24 @@ discard block | ||
| 291 | 290 | $this->pdoSettings | 
| 292 | 291 | ); | 
| 293 | 292 | // Execute init commands once connected | 
| 294 | -                    foreach($this->dumpSettings['init_commands'] as $stmt) { | |
| 293 | +                    foreach ($this->dumpSettings['init_commands'] as $stmt) { | |
| 295 | 294 | $this->dbHandler->exec($stmt); | 
| 296 | 295 | } | 
| 297 | 296 | // Store server version | 
| 298 | 297 | $this->version = $this->dbHandler->getAttribute(PDO::ATTR_SERVER_VERSION); | 
| 299 | 298 | break; | 
| 300 | 299 | default: | 
| 301 | -                    throw new Exception("Unsupported database type (" . $this->dbType . ")"); | |
| 300 | +                    throw new Exception("Unsupported database type (".$this->dbType.")"); | |
| 302 | 301 | } | 
| 303 | 302 |          } catch (PDOException $e) { | 
| 304 | 303 | throw new Exception( | 
| 305 | - "Connection to " . $this->dbType . " failed with message: " . | |
| 304 | + "Connection to ".$this->dbType." failed with message: ". | |
| 306 | 305 | $e->getMessage() | 
| 307 | 306 | ); | 
| 308 | 307 | } | 
| 309 | 308 | |
| 310 | -        if ( is_null($this->dbHandler) ) { | |
| 311 | -            throw new Exception("Connection to ". $this->dbType . "failed"); | |
| 309 | +        if (is_null($this->dbHandler)) { | |
| 310 | +            throw new Exception("Connection to ".$this->dbType."failed"); | |
| 312 | 311 | } | 
| 313 | 312 | |
| 314 | 313 | $this->dbHandler->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_NATURAL); | 
| @@ -368,7 +367,7 @@ discard block | ||
| 368 | 367 | // This check will be removed once include-tables supports regexps | 
| 369 | 368 |          if (0 < count($this->dumpSettings['include-tables'])) { | 
| 370 | 369 |              $name = implode(",", $this->dumpSettings['include-tables']); | 
| 371 | -            throw new Exception("Table (" . $name . ") not found in database"); | |
| 370 | +            throw new Exception("Table (".$name.") not found in database"); | |
| 372 | 371 | } | 
| 373 | 372 | |
| 374 | 373 | $this->exportTables(); | 
| @@ -395,19 +394,19 @@ discard block | ||
| 395 | 394 | private function getDumpFileHeader() | 
| 396 | 395 |      { | 
| 397 | 396 | $header = ''; | 
| 398 | -        if ( !$this->dumpSettings['skip-comments'] ) { | |
| 397 | +        if (!$this->dumpSettings['skip-comments']) { | |
| 399 | 398 | // Some info about software, source and time | 
| 400 | - $header = "-- mysqldump-php https://github.com/ifsnop/mysqldump-php" . PHP_EOL . | |
| 401 | - "--" . PHP_EOL . | |
| 402 | -                    "-- Host: {$this->host}\tDatabase: {$this->dbName}" . PHP_EOL . | |
| 403 | - "-- ------------------------------------------------------" . PHP_EOL; | |
| 399 | + $header = "-- mysqldump-php https://github.com/ifsnop/mysqldump-php".PHP_EOL. | |
| 400 | + "--".PHP_EOL. | |
| 401 | +                    "-- Host: {$this->host}\tDatabase: {$this->dbName}".PHP_EOL. | |
| 402 | + "-- ------------------------------------------------------".PHP_EOL; | |
| 404 | 403 | |
| 405 | -            if ( !empty($this->version) ) { | |
| 406 | - $header .= "-- Server version \t" . $this->version . PHP_EOL; | |
| 404 | +            if (!empty($this->version)) { | |
| 405 | + $header .= "-- Server version \t".$this->version.PHP_EOL; | |
| 407 | 406 | } | 
| 408 | 407 | |
| 409 | -            if ( !$this->dumpSettings['skip-dump-date'] ) { | |
| 410 | -                $header .= "-- Date: " . date('r') . PHP_EOL . PHP_EOL; | |
| 408 | +            if (!$this->dumpSettings['skip-dump-date']) { | |
| 409 | +                $header .= "-- Date: ".date('r').PHP_EOL.PHP_EOL; | |
| 411 | 410 | } | 
| 412 | 411 | } | 
| 413 | 412 | return $header; | 
| @@ -424,7 +423,7 @@ discard block | ||
| 424 | 423 |          if (!$this->dumpSettings['skip-comments']) { | 
| 425 | 424 | $footer .= '-- Dump completed'; | 
| 426 | 425 |              if (!$this->dumpSettings['skip-dump-date']) { | 
| 427 | -                $footer .= ' on: ' . date('r'); | |
| 426 | +                $footer .= ' on: '.date('r'); | |
| 428 | 427 | } | 
| 429 | 428 | $footer .= PHP_EOL; | 
| 430 | 429 | } | 
| @@ -512,10 +511,10 @@ discard block | ||
| 512 | 511 | $match = false; | 
| 513 | 512 | |
| 514 | 513 |          foreach ($arr as $pattern) { | 
| 515 | -            if ( '/' != $pattern[0] ) { | |
| 514 | +            if ('/' != $pattern[0]) { | |
| 516 | 515 | continue; | 
| 517 | 516 | } | 
| 518 | -            if ( 1 == preg_match($pattern, $table) ) { | |
| 517 | +            if (1 == preg_match($pattern, $table)) { | |
| 519 | 518 | $match = true; | 
| 520 | 519 | } | 
| 521 | 520 | } | 
| @@ -532,14 +531,14 @@ discard block | ||
| 532 | 531 |      { | 
| 533 | 532 | // Exporting tables one by one | 
| 534 | 533 |          foreach ($this->tables as $table) { | 
| 535 | -            if ( $this->matches($table, $this->dumpSettings['exclude-tables']) ) { | |
| 534 | +            if ($this->matches($table, $this->dumpSettings['exclude-tables'])) { | |
| 536 | 535 | continue; | 
| 537 | 536 | } | 
| 538 | 537 | $this->getTableStructure($table); | 
| 539 | -            if ( false === $this->dumpSettings['no-data'] ) { // don't break compatibility with old trigger | |
| 538 | +            if (false === $this->dumpSettings['no-data']) { // don't break compatibility with old trigger | |
| 540 | 539 | $this->listValues($table); | 
| 541 | - } else if ( true === $this->dumpSettings['no-data'] | |
| 542 | -                 || $this->matches($table, $this->dumpSettings['no-data']) ) { | |
| 540 | + } else if (true === $this->dumpSettings['no-data'] | |
| 541 | +                 || $this->matches($table, $this->dumpSettings['no-data'])) { | |
| 543 | 542 | continue; | 
| 544 | 543 |              } else { | 
| 545 | 544 | $this->listValues($table); | 
| @@ -557,14 +556,14 @@ discard block | ||
| 557 | 556 |          if (false === $this->dumpSettings['no-create-info']) { | 
| 558 | 557 | // Exporting views one by one | 
| 559 | 558 |              foreach ($this->views as $view) { | 
| 560 | -                if ( $this->matches($view, $this->dumpSettings['exclude-tables']) ) { | |
| 559 | +                if ($this->matches($view, $this->dumpSettings['exclude-tables'])) { | |
| 561 | 560 | continue; | 
| 562 | 561 | } | 
| 563 | 562 | $this->tableColumnTypes[$view] = $this->getTableColumnTypes($view); | 
| 564 | 563 | $this->getViewStructureTable($view); | 
| 565 | 564 | } | 
| 566 | 565 |              foreach ($this->views as $view) { | 
| 567 | -                if ( $this->matches($view, $this->dumpSettings['exclude-tables']) ) { | |
| 566 | +                if ($this->matches($view, $this->dumpSettings['exclude-tables'])) { | |
| 568 | 567 | continue; | 
| 569 | 568 | } | 
| 570 | 569 | $this->getViewStructureView($view); | 
| @@ -623,9 +622,9 @@ discard block | ||
| 623 | 622 |          if (!$this->dumpSettings['no-create-info']) { | 
| 624 | 623 | $ret = ''; | 
| 625 | 624 |              if (!$this->dumpSettings['skip-comments']) { | 
| 626 | - $ret = "--" . PHP_EOL . | |
| 627 | - "-- Table structure for table `$tableName`" . PHP_EOL . | |
| 628 | - "--" . PHP_EOL . PHP_EOL; | |
| 625 | + $ret = "--".PHP_EOL. | |
| 626 | + "-- Table structure for table `$tableName`".PHP_EOL. | |
| 627 | + "--".PHP_EOL.PHP_EOL; | |
| 629 | 628 | } | 
| 630 | 629 | $stmt = $this->typeAdapter->show_create_table($tableName); | 
| 631 | 630 |              foreach ($this->dbHandler->query($stmt) as $r) { | 
| @@ -659,7 +658,7 @@ discard block | ||
| 659 | 658 | ); | 
| 660 | 659 | $columns->setFetchMode(PDO::FETCH_ASSOC); | 
| 661 | 660 | |
| 662 | -        foreach($columns as $key => $col) { | |
| 661 | +        foreach ($columns as $key => $col) { | |
| 663 | 662 | $types = $this->typeAdapter->parseColumnType($col); | 
| 664 | 663 | $columnTypes[$col['Field']] = array( | 
| 665 | 664 | 'is_numeric'=> $types['is_numeric'], | 
| @@ -683,9 +682,9 @@ discard block | ||
| 683 | 682 | private function getViewStructureTable($viewName) | 
| 684 | 683 |      { | 
| 685 | 684 |          if (!$this->dumpSettings['skip-comments']) { | 
| 686 | - $ret = "--" . PHP_EOL . | |
| 687 | -                "-- Stand-In structure for view `${viewName}`" . PHP_EOL . | |
| 688 | - "--" . PHP_EOL . PHP_EOL; | |
| 685 | + $ret = "--".PHP_EOL. | |
| 686 | +                "-- Stand-In structure for view `${viewName}`".PHP_EOL. | |
| 687 | + "--".PHP_EOL.PHP_EOL; | |
| 689 | 688 | $this->compressManager->write($ret); | 
| 690 | 689 | } | 
| 691 | 690 | $stmt = $this->typeAdapter->show_create_view($viewName); | 
| @@ -714,13 +713,13 @@ discard block | ||
| 714 | 713 | */ | 
| 715 | 714 |      function createStandInTable($viewName) { | 
| 716 | 715 | $ret = array(); | 
| 717 | -        foreach($this->tableColumnTypes[$viewName] as $k => $v) { | |
| 716 | +        foreach ($this->tableColumnTypes[$viewName] as $k => $v) { | |
| 718 | 717 |              $ret[] = "`${k}` ${v['type_sql']}"; | 
| 719 | 718 | } | 
| 720 | - $ret = implode(PHP_EOL . ",", $ret); | |
| 719 | + $ret = implode(PHP_EOL.",", $ret); | |
| 721 | 720 | |
| 722 | -        $ret = "CREATE TABLE IF NOT EXISTS `$viewName` (" . | |
| 723 | - PHP_EOL . $ret . PHP_EOL . ");" . PHP_EOL; | |
| 721 | +        $ret = "CREATE TABLE IF NOT EXISTS `$viewName` (". | |
| 722 | + PHP_EOL.$ret.PHP_EOL.");".PHP_EOL; | |
| 724 | 723 | |
| 725 | 724 | return $ret; | 
| 726 | 725 | } | 
| @@ -735,9 +734,9 @@ discard block | ||
| 735 | 734 | private function getViewStructureView($viewName) | 
| 736 | 735 |      { | 
| 737 | 736 |          if (!$this->dumpSettings['skip-comments']) { | 
| 738 | - $ret = "--" . PHP_EOL . | |
| 739 | -                "-- View structure for view `${viewName}`" . PHP_EOL . | |
| 740 | - "--" . PHP_EOL . PHP_EOL; | |
| 737 | + $ret = "--".PHP_EOL. | |
| 738 | +                "-- View structure for view `${viewName}`".PHP_EOL. | |
| 739 | + "--".PHP_EOL.PHP_EOL; | |
| 741 | 740 | $this->compressManager->write($ret); | 
| 742 | 741 | } | 
| 743 | 742 | $stmt = $this->typeAdapter->show_create_view($viewName); | 
| @@ -787,9 +786,9 @@ discard block | ||
| 787 | 786 | private function getProcedureStructure($procedureName) | 
| 788 | 787 |      { | 
| 789 | 788 |          if (!$this->dumpSettings['skip-comments']) { | 
| 790 | - $ret = "--" . PHP_EOL . | |
| 791 | - "-- Dumping routines for database '" . $this->dbName . "'" . PHP_EOL . | |
| 792 | - "--" . PHP_EOL . PHP_EOL; | |
| 789 | + $ret = "--".PHP_EOL. | |
| 790 | + "-- Dumping routines for database '".$this->dbName."'".PHP_EOL. | |
| 791 | + "--".PHP_EOL.PHP_EOL; | |
| 793 | 792 | $this->compressManager->write($ret); | 
| 794 | 793 | } | 
| 795 | 794 | $stmt = $this->typeAdapter->show_create_procedure($procedureName); | 
| @@ -810,9 +809,9 @@ discard block | ||
| 810 | 809 | private function getEventStructure($eventName) | 
| 811 | 810 |      { | 
| 812 | 811 |          if (!$this->dumpSettings['skip-comments']) { | 
| 813 | - $ret = "--" . PHP_EOL . | |
| 814 | - "-- Dumping events for database '" . $this->dbName . "'" . PHP_EOL . | |
| 815 | - "--" . PHP_EOL . PHP_EOL; | |
| 812 | + $ret = "--".PHP_EOL. | |
| 813 | + "-- Dumping events for database '".$this->dbName."'".PHP_EOL. | |
| 814 | + "--".PHP_EOL.PHP_EOL; | |
| 816 | 815 | $this->compressManager->write($ret); | 
| 817 | 816 | } | 
| 818 | 817 | $stmt = $this->typeAdapter->show_create_event($eventName); | 
| @@ -900,7 +899,7 @@ discard block | ||
| 900 | 899 | $lineSize = 0; | 
| 901 | 900 | |
| 902 | 901 | $colStmt = $this->getColumnStmt($tableName); | 
| 903 | -        $stmt = "SELECT " . implode(",", $colStmt) . " FROM `$tableName`"; | |
| 902 | +        $stmt = "SELECT ".implode(",", $colStmt)." FROM `$tableName`"; | |
| 904 | 903 | |
| 905 | 904 |          if ($this->dumpSettings['where']) { | 
| 906 | 905 |              $stmt .= " WHERE {$this->dumpSettings['where']}"; | 
| @@ -914,29 +913,29 @@ discard block | ||
| 914 | 913 | |
| 915 | 914 |                  if ($this->dumpSettings['complete-insert']) { | 
| 916 | 915 | $lineSize += $this->compressManager->write( | 
| 917 | -                        "INSERT INTO `$tableName` (" . | |
| 918 | -                        implode(", ", $colStmt) . | |
| 919 | -                        ") VALUES (" . implode(",", $vals) . ")" | |
| 916 | +                        "INSERT INTO `$tableName` (". | |
| 917 | +                        implode(", ", $colStmt). | |
| 918 | +                        ") VALUES (".implode(",", $vals).")" | |
| 920 | 919 | ); | 
| 921 | 920 |                  } else { | 
| 922 | 921 | $lineSize += $this->compressManager->write( | 
| 923 | -                        "INSERT INTO `$tableName` VALUES (" . implode(",", $vals) . ")" | |
| 922 | +                        "INSERT INTO `$tableName` VALUES (".implode(",", $vals).")" | |
| 924 | 923 | ); | 
| 925 | 924 | } | 
| 926 | 925 | $onlyOnce = false; | 
| 927 | 926 |              } else { | 
| 928 | -                $lineSize += $this->compressManager->write(",(" . implode(",", $vals) . ")"); | |
| 927 | +                $lineSize += $this->compressManager->write(",(".implode(",", $vals).")"); | |
| 929 | 928 | } | 
| 930 | 929 | if (($lineSize > $this->dumpSettings['net_buffer_length']) || | 
| 931 | 930 |                      !$this->dumpSettings['extended-insert']) { | 
| 932 | 931 | $onlyOnce = true; | 
| 933 | -                $lineSize = $this->compressManager->write(";" . PHP_EOL); | |
| 932 | +                $lineSize = $this->compressManager->write(";".PHP_EOL); | |
| 934 | 933 | } | 
| 935 | 934 | } | 
| 936 | 935 | $resultSet->closeCursor(); | 
| 937 | 936 | |
| 938 | 937 |          if (!$onlyOnce) { | 
| 939 | -            $this->compressManager->write(";" . PHP_EOL); | |
| 938 | +            $this->compressManager->write(";".PHP_EOL); | |
| 940 | 939 | } | 
| 941 | 940 | |
| 942 | 941 | $this->endListValues($tableName); | 
| @@ -953,9 +952,9 @@ discard block | ||
| 953 | 952 |      { | 
| 954 | 953 |          if (!$this->dumpSettings['skip-comments']) { | 
| 955 | 954 | $this->compressManager->write( | 
| 956 | - "--" . PHP_EOL . | |
| 957 | - "-- Dumping data for table `$tableName`" . PHP_EOL . | |
| 958 | - "--" . PHP_EOL . PHP_EOL | |
| 955 | + "--".PHP_EOL. | |
| 956 | + "-- Dumping data for table `$tableName`".PHP_EOL. | |
| 957 | + "--".PHP_EOL.PHP_EOL | |
| 959 | 958 | ); | 
| 960 | 959 | } | 
| 961 | 960 | |
| @@ -1041,7 +1040,7 @@ discard block | ||
| 1041 | 1040 | function getColumnStmt($tableName) | 
| 1042 | 1041 |      { | 
| 1043 | 1042 | $colStmt = array(); | 
| 1044 | -        foreach($this->tableColumnTypes[$tableName] as $colName => $colType) { | |
| 1043 | +        foreach ($this->tableColumnTypes[$tableName] as $colName => $colType) { | |
| 1045 | 1044 |              if ($colType['type'] == 'bit' && $this->dumpSettings['hex-blob']) { | 
| 1046 | 1045 |                  $colStmt[] = "LPAD(HEX(`${colName}`),2,'0') AS `${colName}`"; | 
| 1047 | 1046 |              } else if ($colType['is_blob'] && $this->dumpSettings['hex-blob']) { | 
| @@ -1089,11 +1088,11 @@ discard block | ||
| 1089 | 1088 | public static function create($c) | 
| 1090 | 1089 |      { | 
| 1091 | 1090 | $c = ucfirst(strtolower($c)); | 
| 1092 | -        if (! CompressMethod::isValid($c)) { | |
| 1091 | +        if (!CompressMethod::isValid($c)) { | |
| 1093 | 1092 |              throw new Exception("Compression method ($c) is not defined yet"); | 
| 1094 | 1093 | } | 
| 1095 | 1094 | |
| 1096 | - $method = __NAMESPACE__ . "\\" . "Compress" . $c; | |
| 1095 | + $method = __NAMESPACE__."\\"."Compress".$c; | |
| 1097 | 1096 | |
| 1098 | 1097 | return new $method; | 
| 1099 | 1098 | } | 
| @@ -1105,7 +1104,7 @@ discard block | ||
| 1105 | 1104 | |
| 1106 | 1105 | public function __construct() | 
| 1107 | 1106 |      { | 
| 1108 | -        if (! function_exists("bzopen")) { | |
| 1107 | +        if (!function_exists("bzopen")) { | |
| 1109 | 1108 |              throw new Exception("Compression is enabled, but bzip2 lib is not installed or configured properly"); | 
| 1110 | 1109 | } | 
| 1111 | 1110 | } | 
| @@ -1143,7 +1142,7 @@ discard block | ||
| 1143 | 1142 | |
| 1144 | 1143 | public function __construct() | 
| 1145 | 1144 |      { | 
| 1146 | -        if (! function_exists("gzopen")) { | |
| 1145 | +        if (!function_exists("gzopen")) { | |
| 1147 | 1146 |              throw new Exception("Compression is enabled, but gzip lib is not installed or configured properly"); | 
| 1148 | 1147 | } | 
| 1149 | 1148 | } | 
| @@ -1243,10 +1242,10 @@ discard block | ||
| 1243 | 1242 | public static function create($c, $dbHandler = null, $dumpSettings = array()) | 
| 1244 | 1243 |      { | 
| 1245 | 1244 | $c = ucfirst(strtolower($c)); | 
| 1246 | -        if (! TypeAdapter::isValid($c)) { | |
| 1245 | +        if (!TypeAdapter::isValid($c)) { | |
| 1247 | 1246 |              throw new Exception("Database type support for ($c) not yet available"); | 
| 1248 | 1247 | } | 
| 1249 | - $method = __NAMESPACE__ . "\\" . "TypeAdapter" . $c; | |
| 1248 | + $method = __NAMESPACE__."\\"."TypeAdapter".$c; | |
| 1250 | 1249 | return new $method($dbHandler, $dumpSettings); | 
| 1251 | 1250 | } | 
| 1252 | 1251 | |
| @@ -1267,8 +1266,8 @@ discard block | ||
| 1267 | 1266 | |
| 1268 | 1267 | public function show_create_table($tableName) | 
| 1269 | 1268 |      { | 
| 1270 | - return "SELECT tbl_name as 'Table', sql as 'Create Table' " . | |
| 1271 | - "FROM sqlite_master " . | |
| 1269 | + return "SELECT tbl_name as 'Table', sql as 'Create Table' ". | |
| 1270 | + "FROM sqlite_master ". | |
| 1272 | 1271 | "WHERE type='table' AND tbl_name='$tableName'"; | 
| 1273 | 1272 | } | 
| 1274 | 1273 | |
| @@ -1283,8 +1282,8 @@ discard block | ||
| 1283 | 1282 | |
| 1284 | 1283 | public function show_create_view($viewName) | 
| 1285 | 1284 |      { | 
| 1286 | - return "SELECT tbl_name as 'View', sql as 'Create View' " . | |
| 1287 | - "FROM sqlite_master " . | |
| 1285 | + return "SELECT tbl_name as 'View', sql as 'Create View' ". | |
| 1286 | + "FROM sqlite_master ". | |
| 1288 | 1287 | "WHERE type='view' AND tbl_name='$viewName'"; | 
| 1289 | 1288 | } | 
| 1290 | 1289 | |
| @@ -1526,9 +1525,9 @@ discard block | ||
| 1526 | 1525 | $ret = ""; | 
| 1527 | 1526 | |
| 1528 | 1527 |          $ret .= "CREATE DATABASE /*!32312 IF NOT EXISTS*/ `${databaseName}`". | 
| 1529 | -            " /*!40100 DEFAULT CHARACTER SET ${characterSet} " . | |
| 1530 | -            " COLLATE ${collationDb} */;" . PHP_EOL . PHP_EOL . | |
| 1531 | -            "USE `${databaseName}`;" . PHP_EOL . PHP_EOL; | |
| 1528 | +            " /*!40100 DEFAULT CHARACTER SET ${characterSet} ". | |
| 1529 | +            " COLLATE ${collationDb} */;".PHP_EOL.PHP_EOL. | |
| 1530 | +            "USE `${databaseName}`;".PHP_EOL.PHP_EOL; | |
| 1532 | 1531 | |
| 1533 | 1532 | return $ret; | 
| 1534 | 1533 | } | 
| @@ -1558,23 +1557,23 @@ discard block | ||
| 1558 | 1557 | return "SHOW CREATE EVENT `$eventName`"; | 
| 1559 | 1558 | } | 
| 1560 | 1559 | |
| 1561 | - public function create_table( $row) | |
| 1560 | + public function create_table($row) | |
| 1562 | 1561 |      { | 
| 1563 | -        if ( !isset($row['Create Table']) ) { | |
| 1562 | +        if (!isset($row['Create Table'])) { | |
| 1564 | 1563 |              throw new Exception("Error getting table code, unknown output"); | 
| 1565 | 1564 | } | 
| 1566 | 1565 | |
| 1567 | 1566 | $createTable = $row['Create Table']; | 
| 1568 | -        if ( $this->dumpSettings['reset-auto-increment'] ) { | |
| 1567 | +        if ($this->dumpSettings['reset-auto-increment']) { | |
| 1569 | 1568 | $match = "/AUTO_INCREMENT=[0-9]+/s"; | 
| 1570 | 1569 | $replace = ""; | 
| 1571 | 1570 | $createTable = preg_replace($match, $replace, $createTable); | 
| 1572 | 1571 | } | 
| 1573 | 1572 | |
| 1574 | - $ret = "/*!40101 SET @saved_cs_client = @@character_set_client */;" . PHP_EOL . | |
| 1575 | - "/*!40101 SET character_set_client = " . $this->dumpSettings['default-character-set'] . " */;" . PHP_EOL . | |
| 1576 | - $createTable . ";" . PHP_EOL . | |
| 1577 | - "/*!40101 SET character_set_client = @saved_cs_client */;" . PHP_EOL . | |
| 1573 | + $ret = "/*!40101 SET @saved_cs_client = @@character_set_client */;".PHP_EOL. | |
| 1574 | + "/*!40101 SET character_set_client = ".$this->dumpSettings['default-character-set']." */;".PHP_EOL. | |
| 1575 | + $createTable.";".PHP_EOL. | |
| 1576 | + "/*!40101 SET character_set_client = @saved_cs_client */;".PHP_EOL. | |
| 1578 | 1577 | PHP_EOL; | 
| 1579 | 1578 | return $ret; | 
| 1580 | 1579 | } | 
| @@ -1600,7 +1599,7 @@ discard block | ||
| 1600 | 1599 | $viewStmt = $viewStmtReplaced; | 
| 1601 | 1600 | }; | 
| 1602 | 1601 | |
| 1603 | - $ret .= $viewStmt . ';' . PHP_EOL . PHP_EOL; | |
| 1602 | + $ret .= $viewStmt.';'.PHP_EOL.PHP_EOL; | |
| 1604 | 1603 | return $ret; | 
| 1605 | 1604 | } | 
| 1606 | 1605 | |
| @@ -1622,9 +1621,9 @@ discard block | ||
| 1622 | 1621 | $triggerStmt = $triggerStmtReplaced; | 
| 1623 | 1622 | } | 
| 1624 | 1623 | |
| 1625 | - $ret .= "DELIMITER ;;" . PHP_EOL . | |
| 1626 | - $triggerStmt . ";;" . PHP_EOL . | |
| 1627 | - "DELIMITER ;" . PHP_EOL . PHP_EOL; | |
| 1624 | + $ret .= "DELIMITER ;;".PHP_EOL. | |
| 1625 | + $triggerStmt.";;".PHP_EOL. | |
| 1626 | + "DELIMITER ;".PHP_EOL.PHP_EOL; | |
| 1628 | 1627 | return $ret; | 
| 1629 | 1628 | } | 
| 1630 | 1629 | |
| @@ -1632,19 +1631,19 @@ discard block | ||
| 1632 | 1631 |      { | 
| 1633 | 1632 | $ret = ""; | 
| 1634 | 1633 |          if (!isset($row['Create Procedure'])) { | 
| 1635 | -            throw new Exception("Error getting procedure code, unknown output. " . | |
| 1634 | +            throw new Exception("Error getting procedure code, unknown output. ". | |
| 1636 | 1635 | "Please check 'https://bugs.mysql.com/bug.php?id=14564'"); | 
| 1637 | 1636 | } | 
| 1638 | 1637 | $procedureStmt = $row['Create Procedure']; | 
| 1639 | 1638 | |
| 1640 | - $ret .= "/*!50003 DROP PROCEDURE IF EXISTS `" . | |
| 1641 | - $row['Procedure'] . "` */;" . PHP_EOL . | |
| 1642 | - "/*!40101 SET @saved_cs_client = @@character_set_client */;" . PHP_EOL . | |
| 1643 | - "/*!40101 SET character_set_client = " . $this->dumpSettings['default-character-set'] . " */;" . PHP_EOL . | |
| 1644 | - "DELIMITER ;;" . PHP_EOL . | |
| 1645 | - $procedureStmt . " ;;" . PHP_EOL . | |
| 1646 | - "DELIMITER ;" . PHP_EOL . | |
| 1647 | - "/*!40101 SET character_set_client = @saved_cs_client */;" . PHP_EOL . PHP_EOL; | |
| 1639 | + $ret .= "/*!50003 DROP PROCEDURE IF EXISTS `". | |
| 1640 | + $row['Procedure']."` */;".PHP_EOL. | |
| 1641 | + "/*!40101 SET @saved_cs_client = @@character_set_client */;".PHP_EOL. | |
| 1642 | + "/*!40101 SET character_set_client = ".$this->dumpSettings['default-character-set']." */;".PHP_EOL. | |
| 1643 | + "DELIMITER ;;".PHP_EOL. | |
| 1644 | + $procedureStmt." ;;".PHP_EOL. | |
| 1645 | + "DELIMITER ;".PHP_EOL. | |
| 1646 | + "/*!40101 SET character_set_client = @saved_cs_client */;".PHP_EOL.PHP_EOL; | |
| 1648 | 1647 | |
| 1649 | 1648 | return $ret; | 
| 1650 | 1649 | } | 
| @@ -1652,8 +1651,8 @@ discard block | ||
| 1652 | 1651 | public function create_event($row) | 
| 1653 | 1652 |      { | 
| 1654 | 1653 | $ret = ""; | 
| 1655 | -        if ( !isset($row['Create Event']) ) { | |
| 1656 | -            throw new Exception("Error getting event code, unknown output. " . | |
| 1654 | +        if (!isset($row['Create Event'])) { | |
| 1655 | +            throw new Exception("Error getting event code, unknown output. ". | |
| 1657 | 1656 | "Please check 'http://stackoverflow.com/questions/10853826/mysql-5-5-create-event-gives-syntax-error'"); | 
| 1658 | 1657 | } | 
| 1659 | 1658 | $eventName = $row['Event']; | 
| @@ -1670,27 +1669,27 @@ discard block | ||
| 1670 | 1669 | $eventStmt = $eventStmtReplaced; | 
| 1671 | 1670 | } | 
| 1672 | 1671 | |
| 1673 | - $ret .= "/*!50106 SET @save_time_zone= @@TIME_ZONE */ ;" . PHP_EOL . | |
| 1674 | - "/*!50106 DROP EVENT IF EXISTS `" . $eventName . "` */;" . PHP_EOL . | |
| 1675 | - "DELIMITER ;;" . PHP_EOL . | |
| 1676 | - "/*!50003 SET @saved_cs_client = @@character_set_client */ ;;" . PHP_EOL . | |
| 1677 | - "/*!50003 SET @saved_cs_results = @@character_set_results */ ;;" . PHP_EOL . | |
| 1678 | - "/*!50003 SET @saved_col_connection = @@collation_connection */ ;;" . PHP_EOL . | |
| 1679 | - "/*!50003 SET character_set_client = utf8 */ ;;" . PHP_EOL . | |
| 1680 | - "/*!50003 SET character_set_results = utf8 */ ;;" . PHP_EOL . | |
| 1681 | - "/*!50003 SET collation_connection = utf8_general_ci */ ;;" . PHP_EOL . | |
| 1682 | - "/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;" . PHP_EOL . | |
| 1683 | - "/*!50003 SET sql_mode = '" . $sqlMode . "' */ ;;" . PHP_EOL . | |
| 1684 | - "/*!50003 SET @saved_time_zone = @@time_zone */ ;;" . PHP_EOL . | |
| 1685 | - "/*!50003 SET time_zone = 'SYSTEM' */ ;;" . PHP_EOL . | |
| 1686 | - $eventStmt . " ;;" . PHP_EOL . | |
| 1687 | - "/*!50003 SET time_zone = @saved_time_zone */ ;;" . PHP_EOL . | |
| 1688 | - "/*!50003 SET sql_mode = @saved_sql_mode */ ;;" . PHP_EOL . | |
| 1689 | - "/*!50003 SET character_set_client = @saved_cs_client */ ;;" . PHP_EOL . | |
| 1690 | - "/*!50003 SET character_set_results = @saved_cs_results */ ;;" . PHP_EOL . | |
| 1691 | - "/*!50003 SET collation_connection = @saved_col_connection */ ;;" . PHP_EOL . | |
| 1692 | - "DELIMITER ;" . PHP_EOL . | |
| 1693 | - "/*!50106 SET TIME_ZONE= @save_time_zone */ ;" . PHP_EOL . PHP_EOL; | |
| 1672 | + $ret .= "/*!50106 SET @save_time_zone= @@TIME_ZONE */ ;".PHP_EOL. | |
| 1673 | + "/*!50106 DROP EVENT IF EXISTS `".$eventName."` */;".PHP_EOL. | |
| 1674 | + "DELIMITER ;;".PHP_EOL. | |
| 1675 | + "/*!50003 SET @saved_cs_client = @@character_set_client */ ;;".PHP_EOL. | |
| 1676 | + "/*!50003 SET @saved_cs_results = @@character_set_results */ ;;".PHP_EOL. | |
| 1677 | + "/*!50003 SET @saved_col_connection = @@collation_connection */ ;;".PHP_EOL. | |
| 1678 | + "/*!50003 SET character_set_client = utf8 */ ;;".PHP_EOL. | |
| 1679 | + "/*!50003 SET character_set_results = utf8 */ ;;".PHP_EOL. | |
| 1680 | + "/*!50003 SET collation_connection = utf8_general_ci */ ;;".PHP_EOL. | |
| 1681 | + "/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;".PHP_EOL. | |
| 1682 | + "/*!50003 SET sql_mode = '".$sqlMode."' */ ;;".PHP_EOL. | |
| 1683 | + "/*!50003 SET @saved_time_zone = @@time_zone */ ;;".PHP_EOL. | |
| 1684 | + "/*!50003 SET time_zone = 'SYSTEM' */ ;;".PHP_EOL. | |
| 1685 | + $eventStmt." ;;".PHP_EOL. | |
| 1686 | + "/*!50003 SET time_zone = @saved_time_zone */ ;;".PHP_EOL. | |
| 1687 | + "/*!50003 SET sql_mode = @saved_sql_mode */ ;;".PHP_EOL. | |
| 1688 | + "/*!50003 SET character_set_client = @saved_cs_client */ ;;".PHP_EOL. | |
| 1689 | + "/*!50003 SET character_set_results = @saved_cs_results */ ;;".PHP_EOL. | |
| 1690 | + "/*!50003 SET collation_connection = @saved_col_connection */ ;;".PHP_EOL. | |
| 1691 | + "DELIMITER ;".PHP_EOL. | |
| 1692 | + "/*!50106 SET TIME_ZONE= @save_time_zone */ ;".PHP_EOL.PHP_EOL; | |
| 1694 | 1693 | // Commented because we are doing this in restore_parameters() | 
| 1695 | 1694 | // "/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;" . PHP_EOL . PHP_EOL; | 
| 1696 | 1695 | |
| @@ -1701,8 +1700,8 @@ discard block | ||
| 1701 | 1700 |      { | 
| 1702 | 1701 | $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__); | 
| 1703 | 1702 | $args = func_get_args(); | 
| 1704 | - return "SELECT TABLE_NAME AS tbl_name " . | |
| 1705 | - "FROM INFORMATION_SCHEMA.TABLES " . | |
| 1703 | + return "SELECT TABLE_NAME AS tbl_name ". | |
| 1704 | + "FROM INFORMATION_SCHEMA.TABLES ". | |
| 1706 | 1705 |              "WHERE TABLE_TYPE='BASE TABLE' AND TABLE_SCHEMA='${args[0]}'"; | 
| 1707 | 1706 | } | 
| 1708 | 1707 | |
| @@ -1710,8 +1709,8 @@ discard block | ||
| 1710 | 1709 |      { | 
| 1711 | 1710 | $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__); | 
| 1712 | 1711 | $args = func_get_args(); | 
| 1713 | - return "SELECT TABLE_NAME AS tbl_name " . | |
| 1714 | - "FROM INFORMATION_SCHEMA.TABLES " . | |
| 1712 | + return "SELECT TABLE_NAME AS tbl_name ". | |
| 1713 | + "FROM INFORMATION_SCHEMA.TABLES ". | |
| 1715 | 1714 |              "WHERE TABLE_TYPE='VIEW' AND TABLE_SCHEMA='${args[0]}'"; | 
| 1716 | 1715 | } | 
| 1717 | 1716 | |
| @@ -1733,8 +1732,8 @@ discard block | ||
| 1733 | 1732 |      { | 
| 1734 | 1733 | $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__); | 
| 1735 | 1734 | $args = func_get_args(); | 
| 1736 | - return "SELECT SPECIFIC_NAME AS procedure_name " . | |
| 1737 | - "FROM INFORMATION_SCHEMA.ROUTINES " . | |
| 1735 | + return "SELECT SPECIFIC_NAME AS procedure_name ". | |
| 1736 | + "FROM INFORMATION_SCHEMA.ROUTINES ". | |
| 1738 | 1737 |              "WHERE ROUTINE_TYPE='PROCEDURE' AND ROUTINE_SCHEMA='${args[0]}'"; | 
| 1739 | 1738 | } | 
| 1740 | 1739 | |
| @@ -1748,8 +1747,8 @@ discard block | ||
| 1748 | 1747 |      { | 
| 1749 | 1748 | $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__); | 
| 1750 | 1749 | $args = func_get_args(); | 
| 1751 | - return "SELECT EVENT_NAME AS event_name " . | |
| 1752 | - "FROM INFORMATION_SCHEMA.EVENTS " . | |
| 1750 | + return "SELECT EVENT_NAME AS event_name ". | |
| 1751 | + "FROM INFORMATION_SCHEMA.EVENTS ". | |
| 1753 | 1752 |              "WHERE EVENT_SCHEMA='${args[0]}'"; | 
| 1754 | 1753 | } | 
| 1755 | 1754 | |
| @@ -1785,19 +1784,19 @@ discard block | ||
| 1785 | 1784 |      { | 
| 1786 | 1785 | $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__); | 
| 1787 | 1786 | $args = func_get_args(); | 
| 1788 | -        return "LOCK TABLES `${args[0]}` WRITE;" . PHP_EOL; | |
| 1787 | +        return "LOCK TABLES `${args[0]}` WRITE;".PHP_EOL; | |
| 1789 | 1788 | } | 
| 1790 | 1789 | |
| 1791 | 1790 | public function end_add_lock_table() | 
| 1792 | 1791 |      { | 
| 1793 | - return "UNLOCK TABLES;" . PHP_EOL; | |
| 1792 | + return "UNLOCK TABLES;".PHP_EOL; | |
| 1794 | 1793 | } | 
| 1795 | 1794 | |
| 1796 | 1795 | public function start_add_disable_keys() | 
| 1797 | 1796 |      { | 
| 1798 | 1797 | $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__); | 
| 1799 | 1798 | $args = func_get_args(); | 
| 1800 | -        return "/*!40000 ALTER TABLE `${args[0]}` DISABLE KEYS */;" . | |
| 1799 | +        return "/*!40000 ALTER TABLE `${args[0]}` DISABLE KEYS */;". | |
| 1801 | 1800 | PHP_EOL; | 
| 1802 | 1801 | } | 
| 1803 | 1802 | |
| @@ -1805,57 +1804,57 @@ discard block | ||
| 1805 | 1804 |      { | 
| 1806 | 1805 | $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__); | 
| 1807 | 1806 | $args = func_get_args(); | 
| 1808 | -        return "/*!40000 ALTER TABLE `${args[0]}` ENABLE KEYS */;" . | |
| 1807 | +        return "/*!40000 ALTER TABLE `${args[0]}` ENABLE KEYS */;". | |
| 1809 | 1808 | PHP_EOL; | 
| 1810 | 1809 | } | 
| 1811 | 1810 | |
| 1812 | 1811 | public function start_disable_autocommit() | 
| 1813 | 1812 |      { | 
| 1814 | - return "SET autocommit=0;" . PHP_EOL; | |
| 1813 | + return "SET autocommit=0;".PHP_EOL; | |
| 1815 | 1814 | } | 
| 1816 | 1815 | |
| 1817 | 1816 | public function end_disable_autocommit() | 
| 1818 | 1817 |      { | 
| 1819 | - return "COMMIT;" . PHP_EOL; | |
| 1818 | + return "COMMIT;".PHP_EOL; | |
| 1820 | 1819 | } | 
| 1821 | 1820 | |
| 1822 | 1821 | public function add_drop_database() | 
| 1823 | 1822 |      { | 
| 1824 | 1823 | $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__); | 
| 1825 | 1824 | $args = func_get_args(); | 
| 1826 | -        return "/*!40000 DROP DATABASE IF EXISTS `${args[0]}`*/;" . | |
| 1827 | - PHP_EOL . PHP_EOL; | |
| 1825 | +        return "/*!40000 DROP DATABASE IF EXISTS `${args[0]}`*/;". | |
| 1826 | + PHP_EOL.PHP_EOL; | |
| 1828 | 1827 | } | 
| 1829 | 1828 | |
| 1830 | 1829 | public function add_drop_trigger() | 
| 1831 | 1830 |      { | 
| 1832 | 1831 | $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__); | 
| 1833 | 1832 | $args = func_get_args(); | 
| 1834 | -        return "DROP TRIGGER IF EXISTS `${args[0]}`;" . PHP_EOL; | |
| 1833 | +        return "DROP TRIGGER IF EXISTS `${args[0]}`;".PHP_EOL; | |
| 1835 | 1834 | } | 
| 1836 | 1835 | |
| 1837 | 1836 | public function drop_table() | 
| 1838 | 1837 |      { | 
| 1839 | 1838 | $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__); | 
| 1840 | 1839 | $args = func_get_args(); | 
| 1841 | -        return "DROP TABLE IF EXISTS `${args[0]}`;" . PHP_EOL; | |
| 1840 | +        return "DROP TABLE IF EXISTS `${args[0]}`;".PHP_EOL; | |
| 1842 | 1841 | } | 
| 1843 | 1842 | |
| 1844 | 1843 | public function drop_view() | 
| 1845 | 1844 |      { | 
| 1846 | 1845 | $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__); | 
| 1847 | 1846 | $args = func_get_args(); | 
| 1848 | -        return "DROP TABLE IF EXISTS `${args[0]}`;" . PHP_EOL . | |
| 1849 | -                "/*!50001 DROP VIEW IF EXISTS `${args[0]}`*/;" . PHP_EOL; | |
| 1847 | +        return "DROP TABLE IF EXISTS `${args[0]}`;".PHP_EOL. | |
| 1848 | +                "/*!50001 DROP VIEW IF EXISTS `${args[0]}`*/;".PHP_EOL; | |
| 1850 | 1849 | } | 
| 1851 | 1850 | |
| 1852 | 1851 | public function getDatabaseHeader() | 
| 1853 | 1852 |      { | 
| 1854 | 1853 | $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__); | 
| 1855 | 1854 | $args = func_get_args(); | 
| 1856 | - return "--" . PHP_EOL . | |
| 1857 | -            "-- Current Database: `${args[0]}`" . PHP_EOL . | |
| 1858 | - "--" . PHP_EOL . PHP_EOL; | |
| 1855 | + return "--".PHP_EOL. | |
| 1856 | +            "-- Current Database: `${args[0]}`".PHP_EOL. | |
| 1857 | + "--".PHP_EOL.PHP_EOL; | |
| 1859 | 1858 | } | 
| 1860 | 1859 | |
| 1861 | 1860 | /** | 
| @@ -1870,10 +1869,10 @@ discard block | ||
| 1870 | 1869 | $colInfo = array(); | 
| 1871 | 1870 |          $colParts = explode(" ", $colType['Type']); | 
| 1872 | 1871 | |
| 1873 | -        if($fparen = strpos($colParts[0], "(")) | |
| 1872 | +        if ($fparen = strpos($colParts[0], "(")) | |
| 1874 | 1873 |          { | 
| 1875 | 1874 | $colInfo['type'] = substr($colParts[0], 0, $fparen); | 
| 1876 | -            $colInfo['length']  = str_replace(")", "", substr($colParts[0], $fparen+1)); | |
| 1875 | +            $colInfo['length'] = str_replace(")", "", substr($colParts[0], $fparen + 1)); | |
| 1877 | 1876 | $colInfo['attributes'] = isset($colParts[1]) ? $colParts[1] : NULL; | 
| 1878 | 1877 | } | 
| 1879 | 1878 | else | 
| @@ -1891,20 +1890,20 @@ discard block | ||
| 1891 | 1890 | |
| 1892 | 1891 | public function backup_parameters() | 
| 1893 | 1892 |      { | 
| 1894 | - $ret = "/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;" . PHP_EOL . | |
| 1895 | - "/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;" . PHP_EOL . | |
| 1896 | - "/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;" . PHP_EOL . | |
| 1897 | - "/*!40101 SET NAMES " . $this->dumpSettings['default-character-set'] . " */;" . PHP_EOL; | |
| 1893 | + $ret = "/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;".PHP_EOL. | |
| 1894 | + "/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;".PHP_EOL. | |
| 1895 | + "/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;".PHP_EOL. | |
| 1896 | + "/*!40101 SET NAMES ".$this->dumpSettings['default-character-set']." */;".PHP_EOL; | |
| 1898 | 1897 | |
| 1899 | 1898 |          if (false === $this->dumpSettings['skip-tz-utc']) { | 
| 1900 | - $ret .= "/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;" . PHP_EOL . | |
| 1901 | - "/*!40103 SET TIME_ZONE='+00:00' */;" . PHP_EOL; | |
| 1899 | + $ret .= "/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;".PHP_EOL. | |
| 1900 | + "/*!40103 SET TIME_ZONE='+00:00' */;".PHP_EOL; | |
| 1902 | 1901 | } | 
| 1903 | 1902 | |
| 1904 | - $ret .= "/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;" . PHP_EOL . | |
| 1905 | - "/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;" . PHP_EOL . | |
| 1906 | - "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;" . PHP_EOL . | |
| 1907 | - "/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;" . PHP_EOL .PHP_EOL; | |
| 1903 | + $ret .= "/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;".PHP_EOL. | |
| 1904 | + "/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;".PHP_EOL. | |
| 1905 | + "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;".PHP_EOL. | |
| 1906 | + "/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;".PHP_EOL.PHP_EOL; | |
| 1908 | 1907 | |
| 1909 | 1908 | return $ret; | 
| 1910 | 1909 | } | 
| @@ -1914,16 +1913,16 @@ discard block | ||
| 1914 | 1913 | $ret = ""; | 
| 1915 | 1914 | |
| 1916 | 1915 |          if (false === $this->dumpSettings['skip-tz-utc']) { | 
| 1917 | - $ret .= "/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;" . PHP_EOL; | |
| 1916 | + $ret .= "/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;".PHP_EOL; | |
| 1918 | 1917 | } | 
| 1919 | 1918 | |
| 1920 | - $ret .= "/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;" . PHP_EOL . | |
| 1921 | - "/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;" . PHP_EOL . | |
| 1922 | - "/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;" . PHP_EOL . | |
| 1923 | - "/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;" . PHP_EOL . | |
| 1924 | - "/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;" . PHP_EOL . | |
| 1925 | - "/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;" . PHP_EOL . | |
| 1926 | - "/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;" . PHP_EOL . PHP_EOL; | |
| 1919 | + $ret .= "/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;".PHP_EOL. | |
| 1920 | + "/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;".PHP_EOL. | |
| 1921 | + "/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;".PHP_EOL. | |
| 1922 | + "/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;".PHP_EOL. | |
| 1923 | + "/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;".PHP_EOL. | |
| 1924 | + "/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;".PHP_EOL. | |
| 1925 | + "/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;".PHP_EOL.PHP_EOL; | |
| 1927 | 1926 | |
| 1928 | 1927 | return $ret; | 
| 1929 | 1928 | } | 
| @@ -1938,7 +1937,7 @@ discard block | ||
| 1938 | 1937 | */ | 
| 1939 | 1938 | private function check_parameters($num_args, $expected_num_args, $method_name) | 
| 1940 | 1939 |      { | 
| 1941 | -        if ( $num_args != $expected_num_args ) { | |
| 1940 | +        if ($num_args != $expected_num_args) { | |
| 1942 | 1941 |              throw new Exception("Unexpected parameter passed to $method_name"); | 
| 1943 | 1942 | } | 
| 1944 | 1943 | return; | 
| @@ -1875,8 +1875,7 @@ | ||
| 1875 | 1875 | $colInfo['type'] = substr($colParts[0], 0, $fparen); | 
| 1876 | 1876 |              $colInfo['length']  = str_replace(")", "", substr($colParts[0], $fparen+1)); | 
| 1877 | 1877 | $colInfo['attributes'] = isset($colParts[1]) ? $colParts[1] : NULL; | 
| 1878 | - } | |
| 1879 | - else | |
| 1878 | + } else | |
| 1880 | 1879 |          { | 
| 1881 | 1880 | $colInfo['type'] = $colParts[0]; | 
| 1882 | 1881 | } |