Changeset 100602 in spip-zone


Ignore:
Timestamp:
Nov 21, 2016, 1:27:17 PM (3 years ago)
Author:
marcimat@…
Message:

Mise à jour de la librairie mysqldump_php en version 2.2.

Location:
_plugins_/migrateur/trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/migrateur/trunk/class/Serveur/Action/DumpDatabase.php

    r90831 r100602  
    175175                }
    176176
    177                 $gz = function_exists("gzopen");
     177                $gz = false;
     178                if ($this->gzip_si_possible) {
     179                        $gz = function_exists("gzopen");
     180                }
    178181
    179182                include_spip('lib/mysqldump-php/src/Ifsnop/Mysqldump/Mysqldump');
    180183
    181184                $dump = new Mysqldump(
    182                         $this->source->sql->bdd,
     185                        // mysql:host=localhost;dbname=spip
     186                        $this->source->sql->req . ':host=' . $this->source->sql->serveur . ';dbname=' . $this->source->sql->bdd,
    183187                        $this->source->sql->user,
    184188                        $this->source->sql->pass,
    185                         $this->source->sql->serveur,
    186                         $this->source->sql->req,
    187189                        array(
    188190                                'compress' => $gz ? Mysqldump::GZIP : Mysqldump::NONE,
  • _plugins_/migrateur/trunk/lib/mysqldump-php/README.md

    r88450 r100602  
    1212[Credits](https://github.com/ifsnop/mysqldump-php#credits)
    1313
    14 [![Build Status](https://travis-ci.org/ifsnop/mysqldump-php.png?branch=master)](https://travis-ci.org/ifsnop/mysqldump-php)
     14[![Build Status](https://travis-ci.org/ifsnop/mysqldump-php.svg?branch=devel)](https://travis-ci.org/ifsnop/mysqldump-php)
    1515[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/ifsnop/mysqldump-php/badges/quality-score.png?s=d02891e196a3ca1298619032a538ce8ae8cafd2b)](https://scrutinizer-ci.com/g/ifsnop/mysqldump-php/)
    1616[![Latest Stable Version](https://poser.pugx.org/ifsnop/mysqldump-php/v/stable.png)](https://packagist.org/packages/ifsnop/mysqldump-php)
    1717
    18 This is a php version of linux's mysqldump in terminal "$ mysqldump -u username -p...", without dependencies, output compression and sane defaults.
     18This is a php version of mysqldump cli that comes with MySQL, without dependencies, output compression and sane defaults.
    1919
    2020Out of the box, MySQLDump-PHP supports backing up table structures, the data itself, views and triggers.
     21
     22MySQLDump-PHP is the only library that supports:
     23* output binary blobs as hex.
     24* resolves view dependencies (using Stand-In tables).
     25* output compared against original mysqldump. Linked to travis-ci testing system.
     26* dumps stored procedures.
     27* does extended-insert and/or complete-insert.
     28
     29## Important
     30
     31From version 2.0, connections to database are made using the standard DSN, documented in [PDO connection string](http://php.net/manual/en/ref.pdo-mysql.connection.php).
    2132
    2233## Requirements
     
    3142
    3243```
    33 $ composer require ifsnop/mysqldump-php:1.*
     44$ composer require ifsnop/mysqldump-php:2.*
    3445
    3546```
     
    3950````
    4051"require": {
    41         "ifsnop/mysqldump-php":"1.*"
     52        "ifsnop/mysqldump-php":"2.*"
    4253}
    4354````
     
    4657
    4758```
    48 $ curl --silent --location https://github.com/ifsnop/mysqldump-php/archive/v1.4.1.tar.gz | tar xvfz -
     59$ curl --silent --location https://github.com/ifsnop/mysqldump-php/archive/v2.0.0.tar.gz | tar xvfz -
    4960```
    5061
     
    5970
    6071try {
    61     $dump = new IMysqldump\Mysqldump('database', 'username', 'password');
     72    $dump = new IMysqldump\Mysqldump('mysql:host=localhost;dbname=testdb', 'username', 'password');
    6273    $dump->start('storage/work/dump.sql');
    6374} catch (\Exception $e) {
     
    7384<?php
    7485
    75     include_once(dirname(__FILE__) . '/mysqldump-php-1.4.1/src/Ifsnop/Mysqldump/Mysqldump.php');
    76     $dump = new Ifsnop\Mysqldump\Mysqldump( 'database', 'username', 'password');
     86    include_once(dirname(__FILE__) . '/mysqldump-php-2.0.0/src/Ifsnop/Mysqldump/Mysqldump.php');
     87    $dump = new Ifsnop\Mysqldump\Mysqldump('mysql:host=localhost;dbname=testdb', 'username', 'password');
    7788    $dump->start('storage/work/dump.sql');
    7889
     
    8394
    8495## Constructor and default parameters
    85 
    8696    /**
    8797     * Constructor of Mysqldump. Note that in the case of an SQLite database
    8898     * connection, the filename must be in the $db parameter.
    8999     *
    90      * @param string $db         Database name
     100     * @param string $dsn        PDO DSN connection string
    91101     * @param string $user       SQL account username
    92102     * @param string $pass       SQL account password
    93      * @param string $host       SQL server to connect to
    94      * @param string $type       SQL database type ('mysql', 'sqlite', ...)
    95103     * @param array  $dumpSettings SQL database settings
    96104     * @param array  $pdoSettings  PDO configured attributes
    97      *
    98      * @return null
    99105     */
    100106    public function __construct(
    101         $db = '',
     107        $dsn = '',
    102108        $user = '',
    103109        $pass = '',
    104         $host = 'localhost',
    105         $type = 'mysql',
    106110        $dumpSettings = array(),
    107111        $pdoSettings = array()
     
    118122        'add-locks' => true,
    119123        'extended-insert' => true,
     124        'complete-insert' => false,
    120125        'disable-keys' => true,
    121126        'where' => '',
     
    123128        'skip-triggers' => false,
    124129        'add-drop-trigger' => true,
     130        'routines' => false,
    125131        'hex-blob' => true,
    126132        'databases' => false,
     
    146152
    147153- **include-tables**
    148   - Only include these tables (array of table names)
     154  - Only include these tables (array of table names), include all if empty
    149155- **exclude-tables**
    150   - Exclude these tables (array of table names)
     156  - Exclude these tables (array of table names), include all if empty, supports regexps
    151157- **compress**
    152158  - Gzip, Bzip2, None.
     
    164170- **extended-insert**
    165171  - http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_extended-insert
     172- **complete-insert**
     173  - http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_complete-insert
    166174- **disable-keys**
    167175  - http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_disable-keys
     
    174182- **add-drop-triggers**
    175183  - http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_add-drop-trigger
     184- **routines**
     185  - http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_routines
    176186- **hex-blob**
    177187  - http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_hex-blob
     
    180190- **add-drop-database**
    181191  - http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_add-drop-database
    182 - **skip-tz-utz**
     192- **skip-tz-utc**
    183193  - http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option_mysqldump_tz-utc
    184194- **no-autocommit**
     
    228238[Which are the minimum privileges required to get a backup of a MySQL database schema?](http://dba.stackexchange.com/questions/55546/which-are-the-minimum-privileges-required-to-get-a-backup-of-a-mysql-database-sc/55572#55572)
    229239
     240## Tests
     241
     242Current code for testing is an ugly hack. Probably there are much better ways
     243of doing them using PHPUnit, so PR's are welcomed. The testing script creates
     244and populates a database using all possible datatypes. Then it exports it
     245using both mysqldump-php and mysqldump, and compares the output. Only if
     246it is identical tests are OK.
     247
    230248## TODO
    231249
    232 - Write unit tests.
     250...
    233251
    234252## Contributing
  • _plugins_/migrateur/trunk/lib/mysqldump-php/src/Ifsnop/Mysqldump/Mysqldump.php

    r88450 r100602  
    4646    const UTF8MB4 = 'utf8mb4';
    4747
    48     // This can be set both on constructor or manually
    49     public $host;
    50     public $port;
     48    /**
     49    * Database username
     50    * @var string
     51    */
    5152    public $user;
     53    /**
     54    * Database password
     55    * @var string
     56    */
    5257    public $pass;
    53     public $db;
    54     public $fileName;
     58    /**
     59    * Connection string for PDO
     60    * @var string
     61    */
     62    public $dsn;
     63    /**
     64    * Destination filename, defaults to stdout
     65    * @var string
     66    */
     67    public $fileName = 'php://output';
    5568
    5669    // Internal stuff
     
    5871    private $views = array();
    5972    private $triggers = array();
     73    private $procedures = array();
    6074    private $dbHandler;
    6175    private $dbType;
     
    6680    private $version;
    6781    private $tableColumnTypes = array();
     82    /**
     83    * database name, parsed from dsn
     84    * @var string
     85    */
     86    private $dbName;
     87    /**
     88    * host name, parsed from dsn
     89    * @var string
     90    */
     91    private $host;
     92    /**
     93    * dsn string parsed as an array
     94    * @var array
     95    */
     96    private $dsnArray = array();
    6897
    6998    /**
     
    71100     * connection, the filename must be in the $db parameter.
    72101     *
    73      * @param string $db         Database name
     102     * @param string $dsn        PDO DSN connection string
    74103     * @param string $user       SQL account username
    75104     * @param string $pass       SQL account password
    76      * @param string $host       SQL server to connect to
    77      * @param string $type       SQL database type
    78105     * @param array  $dumpSettings SQL database settings
    79106     * @param array  $pdoSettings  PDO configured attributes
    80107     */
    81108    public function __construct(
    82         $db = '',
     109        $dsn = '',
    83110        $user = '',
    84111        $pass = '',
    85         $host = 'localhost',
    86         $type = 'mysql',
    87112        $dumpSettings = array(),
    88113        $pdoSettings = array()
     
    98123            'add-locks' => true,
    99124            'extended-insert' => true,
     125            'complete-insert' => false,
    100126            'disable-keys' => true,
    101127            'where' => '',
     
    103129            'skip-triggers' => false,
    104130            'add-drop-trigger' => true,
    105             'hex-blob' => true,
     131            'routines' => false,
     132            'hex-blob' => true, /* faster than escaped content */
    106133            'databases' => false,
    107134            'add-drop-database' => false,
    108             'skip-tz-utz' => false,
     135            'skip-tz-utc' => false,
    109136            'no-autocommit' => true,
    110137            'default-character-set' => Mysqldump::UTF8,
    111138            'skip-comments' => false,
    112139            'skip-dump-date' => false,
     140            'init_commands' => array(),
    113141            /* deprecated */
    114142            'disable-foreign-keys-check' => true
     
    121149        );
    122150
    123         $this->db = $db;
    124151        $this->user = $user;
    125152        $this->pass = $pass;
    126 
    127         $colonPos = strpos($host, ':');
    128         if (false !== $colonPos) {
    129             $this->port = substr($host, $colonPos + 1);
    130             $this->host = substr($host, 0, $colonPos);
    131         } else {
    132             $this->port = null;
    133             $this->host = $host;
    134         }
    135 
    136         $this->dbType = strtolower($type);
     153        $this->parseDsn($dsn);
    137154        $this->pdoSettings = self::array_replace_recursive($pdoSettingsDefault, $pdoSettings);
    138155        $this->dumpSettings = self::array_replace_recursive($dumpSettingsDefault, $dumpSettings);
    139156
    140         if (!isset($this->pdoSettings[PDO::MYSQL_ATTR_INIT_COMMAND])) {
    141             $this->pdoSettings[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES " . $this->dumpSettings['default-character-set'];
     157        $this->dumpSettings['init_commands'][] = "SET NAMES " . $this->dumpSettings['default-character-set'];
     158
     159        if (false === $this->dumpSettings['skip-tz-utc']) {
     160            $this->dumpSettings['init_commands'][] = "SET TIME_ZONE='+00:00'";
    142161        }
    143162
     
    147166        }
    148167
     168        if ( !is_array($this->dumpSettings['include-tables']) ||
     169            !is_array($this->dumpSettings['exclude-tables']) ) {
     170            throw new Exception("Include-tables and exclude-tables should be arrays");
     171        }
     172
     173        // Dump the same views as tables, mimic mysqldump behaviour
     174        $this->dumpSettings['include-views'] = $this->dumpSettings['include-tables'];
     175
    149176        // Create a new compressManager to manage compressed output
    150177        $this->compressManager = CompressManagerFactory::create($this->dumpSettings['compress']);
     178    }
     179
     180    /**
     181     * Destructor of Mysqldump. Unsets dbHandlers and database objects.
     182     *
     183     */
     184    public function __destruct()
     185    {
     186        $this->dbHandler = null;
    151187    }
    152188
     
    177213
    178214    /**
     215     * Parse DSN string and extract dbname value
     216     * Several examples of a DSN string
     217     *   mysql:host=localhost;dbname=testdb
     218     *   mysql:host=localhost;port=3307;dbname=testdb
     219     *   mysql:unix_socket=/tmp/mysql.sock;dbname=testdb
     220     *
     221     * @param string $dsn dsn string to parse
     222     */
     223    private function parseDsn($dsn)
     224    {
     225        if (empty($dsn) || (false === ($pos = strpos($dsn, ":")))) {
     226            throw new Exception("Empty DSN string");
     227        }
     228
     229        $this->dsn = $dsn;
     230        $this->dbType = strtolower(substr($dsn, 0, $pos));
     231
     232        if (empty($this->dbType)) {
     233            throw new Exception("Missing database type from DSN string");
     234        }
     235
     236        $dsn = substr($dsn, $pos + 1);
     237
     238        foreach(explode(";", $dsn) as $kvp) {
     239            $kvpArr = explode("=", $kvp);
     240            $this->dsnArray[strtolower($kvpArr[0])] = $kvpArr[1];
     241        }
     242
     243        if (empty($this->dsnArray['host']) &&
     244            empty($this->dsnArray['unix_socket'])) {
     245            throw new Exception("Missing host from DSN string");
     246        }
     247        $this->host = (!empty($this->dsnArray['host'])) ?
     248            $this->dsnArray['host'] :
     249            $this->dsnArray['unix_socket'];
     250
     251        if (empty($this->dsnArray['dbname'])) {
     252            throw new Exception("Missing database name from DSN string");
     253        }
     254
     255        $this->dbName = $this->dsnArray['dbname'];
     256
     257        return true;
     258    }
     259
     260    /**
    179261     * Connect with PDO
    180262     *
     
    187269            switch ($this->dbType) {
    188270                case 'sqlite':
    189                     $this->dbHandler = new PDO("sqlite:" . $this->db, null, null, $this->pdoSettings);
     271                    $this->dbHandler = @new PDO("sqlite:" . $this->dbName, null, null, $this->pdoSettings);
    190272                    break;
    191273                case 'mysql':
    192274                case 'pgsql':
    193275                case 'dblib':
    194                     $dsn =  $this->dbType .
    195                         ":host=" . $this->host .
    196                          (isset($this->port) ? ";port=" . $this->port : "") .
    197                         ";dbname=" . $this->db;
    198                     $this->dbHandler = new PDO(
    199                         $dsn,
     276                    $this->dbHandler = @new PDO(
     277                        $this->dsn,
    200278                        $this->user,
    201279                        $this->pass,
    202280                        $this->pdoSettings
    203281                    );
    204                     // Fix for always-unicode output
    205                     $this->dbHandler->exec("SET NAMES " . $this->dumpSettings['default-character-set']);
     282                    // Execute init commands once connected
     283                    foreach($this->dumpSettings['init_commands'] as $stmt) {
     284                        $this->dbHandler->exec($stmt);
     285                    }
    206286                    // Store server version
    207287                    $this->version = $this->dbHandler->getAttribute(PDO::ATTR_SERVER_VERSION);
     
    233313            $this->fileName = $filename;
    234314        }
    235         // We must set a name to continue
    236         if (empty($this->fileName)) {
    237             throw new Exception("Output file name is not set");
    238         }
    239315
    240316        // Connect to database
     
    254330        if ($this->dumpSettings['databases']) {
    255331            $this->compressManager->write(
    256                 $this->typeAdapter->getDatabaseHeader($this->db)
     332                $this->typeAdapter->getDatabaseHeader($this->dbName)
    257333            );
    258334            if ($this->dumpSettings['add-drop-database']) {
    259335                $this->compressManager->write(
    260                     $this->typeAdapter->add_drop_database($this->db)
     336                    $this->typeAdapter->add_drop_database($this->dbName)
    261337                );
    262338            }
     
    268344        if ($this->dumpSettings['databases']) {
    269345            $this->compressManager->write(
    270                 $this->typeAdapter->databases($this->db)
     346                $this->typeAdapter->databases($this->dbName)
    271347            );
    272348        }
     
    275351        // that means that some tables or views weren't found.
    276352        // Give proper error and exit.
     353        // This check will be removed once include-tables supports regexps
    277354        if (0 < count($this->dumpSettings['include-tables'])) {
    278355            $name = implode(",", $this->dumpSettings['include-tables']);
    279             throw new Exception("Table or View (" . $name . ") not found in database");
     356            throw new Exception("Table (" . $name . ") not found in database");
    280357        }
    281358
     
    283360        $this->exportViews();
    284361        $this->exportTriggers();
     362        $this->exportProcedures();
    285363
    286364        // Restore saved parameters
     
    302380    {
    303381        $header = '';
    304         if (!$this->dumpSettings['skip-comments']) {
     382        if ( !$this->dumpSettings['skip-comments'] ) {
    305383            // Some info about software, source and time
    306384            $header = "-- mysqldump-php https://github.com/ifsnop/mysqldump-php" . PHP_EOL .
    307385                    "--" . PHP_EOL .
    308                     "-- Host: {$this->host}\tDatabase: {$this->db}" . PHP_EOL .
     386                    "-- Host: {$this->host}\tDatabase: {$this->dbName}" . PHP_EOL .
    309387                    "-- ------------------------------------------------------" . PHP_EOL;
    310388
    311             if (!empty($this->version)) {
     389            if ( !empty($this->version) ) {
    312390                $header .= "-- Server version \t" . $this->version . PHP_EOL;
    313391            }
    314392
    315             $header .= "-- Date: " . date('r') . PHP_EOL . PHP_EOL;
     393            if ( !$this->dumpSettings['skip-dump-date'] ) {
     394                $header .= "-- Date: " . date('r') . PHP_EOL . PHP_EOL;
     395            }
    316396        }
    317397        return $header;
     
    348428        if (empty($this->dumpSettings['include-tables'])) {
    349429            // include all tables for now, blacklisting happens later
    350             foreach ($this->dbHandler->query($this->typeAdapter->show_tables($this->db)) as $row) {
     430            foreach ($this->dbHandler->query($this->typeAdapter->show_tables($this->dbName)) as $row) {
    351431                array_push($this->tables, current($row));
    352432            }
    353433        } else {
    354434            // include only the tables mentioned in include-tables
    355             foreach ($this->dbHandler->query($this->typeAdapter->show_tables($this->db)) as $row) {
     435            foreach ($this->dbHandler->query($this->typeAdapter->show_tables($this->dbName)) as $row) {
    356436                if (in_array(current($row), $this->dumpSettings['include-tables'], true)) {
    357437                    array_push($this->tables, current($row));
     
    366446
    367447        // Listing all views from database
    368         if (empty($this->dumpSettings['include-tables'])) {
     448        if (empty($this->dumpSettings['include-views'])) {
    369449            // include all views for now, blacklisting happens later
    370             foreach ($this->dbHandler->query($this->typeAdapter->show_views($this->db)) as $row) {
     450            foreach ($this->dbHandler->query($this->typeAdapter->show_views($this->dbName)) as $row) {
    371451                array_push($this->views, current($row));
    372452            }
    373453        } else {
    374454            // include only the tables mentioned in include-tables
    375             foreach ($this->dbHandler->query($this->typeAdapter->show_views($this->db)) as $row) {
    376                 if (in_array(current($row), $this->dumpSettings['include-tables'], true)) {
     455            foreach ($this->dbHandler->query($this->typeAdapter->show_views($this->dbName)) as $row) {
     456                if (in_array(current($row), $this->dumpSettings['include-views'], true)) {
    377457                    array_push($this->views, current($row));
    378458                    $elem = array_search(
    379459                        current($row),
    380                         $this->dumpSettings['include-tables']
     460                        $this->dumpSettings['include-views']
    381461                    );
    382                     unset($this->dumpSettings['include-tables'][$elem]);
     462                    unset($this->dumpSettings['include-views'][$elem]);
    383463                }
    384464            }
     
    387467        // Listing all triggers from database
    388468        if (false === $this->dumpSettings['skip-triggers']) {
    389             foreach ($this->dbHandler->query($this->typeAdapter->show_triggers($this->db)) as $row) {
     469            foreach ($this->dbHandler->query($this->typeAdapter->show_triggers($this->dbName)) as $row) {
    390470                array_push($this->triggers, $row['Trigger']);
    391471            }
    392472        }
     473
     474        // Listing all procedures from database
     475        if ($this->dumpSettings['routines']) {
     476            foreach ($this->dbHandler->query($this->typeAdapter->show_procedures($this->dbName)) as $row) {
     477                array_push($this->procedures, $row['procedure_name']);
     478            }
     479        }
     480    }
     481
     482    /**
     483     * Compare if $table name matches with a definition inside $arr
     484     * @param $table string
     485     * @param $arr array with strings or patterns
     486     * @return bool
     487     */
     488    private function matches($table, $arr) {
     489        $match = false;
     490
     491        foreach ($arr as $pattern) {
     492            if ( '/' != $pattern[0] ) {
     493                continue;
     494            }
     495            if ( 1 == preg_match($pattern, $table) ) {
     496                $match = true;
     497            }
     498        }
     499
     500        return in_array($table, $arr) || $match;
    393501    }
    394502
     
    402510        // Exporting tables one by one
    403511        foreach ($this->tables as $table) {
    404             if (in_array($table, $this->dumpSettings['exclude-tables'], true)) {
     512            if ( $this->matches($table, $this->dumpSettings['exclude-tables']) ) {
    405513                continue;
    406514            }
    407515            $this->getTableStructure($table);
    408             if (false === $this->dumpSettings['no-data']) {
     516            if ( false === $this->dumpSettings['no-data'] ) {
    409517                $this->listValues($table);
    410518            }
     
    422530            // Exporting views one by one
    423531            foreach ($this->views as $view) {
    424                 if (in_array($view, $this->dumpSettings['exclude-tables'], true)) {
     532                if ( $this->matches($view, $this->dumpSettings['exclude-tables']) ) {
    425533                    continue;
    426534                }
    427                 $this->getViewStructure($view);
     535                $this->tableColumnTypes[$view] = $this->getTableColumnTypes($view);
     536                $this->getViewStructureTable($view);
     537            }
     538            foreach ($this->views as $view) {
     539                if ( $this->matches($view, $this->dumpSettings['exclude-tables']) ) {
     540                    continue;
     541                }
     542                $this->getViewStructureView($view);
    428543            }
    429544        }
     
    440555        foreach ($this->triggers as $trigger) {
    441556            $this->getTriggerStructure($trigger);
     557        }
     558    }
     559
     560    /**
     561     * Exports all the procedures found in database
     562     *
     563     * @return null
     564     */
     565    private function exportProcedures()
     566    {
     567        // Exporting triggers one by one
     568        foreach ($this->procedures as $procedure) {
     569            $this->getProcedureStructure($procedure);
    442570        }
    443571    }
     
    473601            }
    474602        }
    475 
     603        $this->tableColumnTypes[$tableName] = $this->getTableColumnTypes($tableName);
     604        return;
     605    }
     606
     607    /**
     608     * Store column types to create data dumps and for Stand-In tables
     609     *
     610     * @param string $tableName  Name of table to export
     611     * @return array type column types detailed
     612     */
     613
     614    private function getTableColumnTypes($tableName) {
    476615        $columnTypes = array();
    477616        $columns = $this->dbHandler->query(
     
    485624                'is_numeric'=> $types['is_numeric'],
    486625                'is_blob' => $types['is_blob'],
    487                 'type' => $types['type']
     626                'type' => $types['type'],
     627                'type_sql' => $col['Type']
    488628            );
    489629        }
    490         $this->tableColumnTypes[$tableName] = $columnTypes;
    491         return;
    492     }
    493 
    494     /**
    495      * View structure extractor
     630
     631        return $columnTypes;
     632    }
     633
     634    /**
     635     * View structure extractor, create table (avoids cyclic references)
    496636     *
    497637     * @todo move mysql specific code to typeAdapter
     
    499639     * @return null
    500640     */
    501     private function getViewStructure($viewName)
    502     {
    503         $ret = '';
     641    private function getViewStructureTable($viewName)
     642    {
    504643        if (!$this->dumpSettings['skip-comments']) {
    505644            $ret = "--" . PHP_EOL .
    506                 "-- Table structure for view `${viewName}`" . PHP_EOL .
     645                "-- Stand-In structure for view `${viewName}`" . PHP_EOL .
    507646                "--" . PHP_EOL . PHP_EOL;
    508         }
    509         $this->compressManager->write($ret);
     647            $this->compressManager->write($ret);
     648        }
    510649        $stmt = $this->typeAdapter->show_create_view($viewName);
     650
     651        // create views as tables, to resolve dependencies
    511652        foreach ($this->dbHandler->query($stmt) as $r) {
    512653            if ($this->dumpSettings['add-drop-table']) {
     
    515656                );
    516657            }
     658
     659            $this->compressManager->write(
     660                $this->createStandInTable($viewName)
     661            );
     662            break;
     663        }
     664    }
     665
     666    /**
     667     * Write a create table statement for the table Stand-In, show create
     668     * table would return a create algorithm when used on a view
     669     *
     670     * @param string $viewName  Name of view to export
     671     * @return string create statement
     672     */
     673    function createStandInTable($viewName) {
     674        $ret = array();
     675        foreach($this->tableColumnTypes[$viewName] as $k => $v) {
     676            $ret[] = "`${k}` ${v['type_sql']}";
     677        }
     678        $ret = implode(PHP_EOL . ",", $ret);
     679
     680        $ret = "CREATE TABLE IF NOT EXISTS `$viewName` (" .
     681            PHP_EOL . $ret . PHP_EOL . ");" . PHP_EOL;
     682
     683        return $ret;
     684    }
     685
     686    /**
     687     * View structure extractor, create view
     688     *
     689     * @todo move mysql specific code to typeAdapter
     690     * @param string $viewName  Name of view to export
     691     * @return null
     692     */
     693    private function getViewStructureView($viewName)
     694    {
     695        if (!$this->dumpSettings['skip-comments']) {
     696            $ret = "--" . PHP_EOL .
     697                "-- View structure for view `${viewName}`" . PHP_EOL .
     698                "--" . PHP_EOL . PHP_EOL;
     699            $this->compressManager->write($ret);
     700        }
     701        $stmt = $this->typeAdapter->show_create_view($viewName);
     702
     703        // create views, to resolve dependencies
     704        // replacing tables with views
     705        foreach ($this->dbHandler->query($stmt) as $r) {
     706            // because we must replace table with view, we should delete it
     707            $this->compressManager->write(
     708                $this->typeAdapter->drop_view($viewName)
     709            );
    517710            $this->compressManager->write(
    518711                $this->typeAdapter->create_view($r)
     
    542735            return;
    543736        }
    544 
    545     }
    546 
     737    }
     738
     739    /**
     740     * Procedure structure extractor
     741     *
     742     * @param string $procedureName  Name of procedure to export
     743     * @return null
     744     */
     745    private function getProcedureStructure($procedureName)
     746    {
     747        if (!$this->dumpSettings['skip-comments']) {
     748            $ret = "--" . PHP_EOL .
     749                "-- Dumping routines for database '" . $this->dbName . "'" . PHP_EOL .
     750                "--" . PHP_EOL . PHP_EOL;
     751            $this->compressManager->write($ret);
     752        }
     753        $stmt = $this->typeAdapter->show_create_procedure($procedureName);
     754        foreach ($this->dbHandler->query($stmt) as $r) {
     755            $this->compressManager->write(
     756                $this->typeAdapter->create_procedure($r, $this->dumpSettings)
     757            );
     758            return;
     759        }
     760    }
    547761
    548762    /**
     
    602816            $vals = $this->escape($tableName, $row);
    603817            if ($onlyOnce || !$this->dumpSettings['extended-insert']) {
    604                 $lineSize += $this->compressManager->write(
    605                     "INSERT INTO `$tableName` VALUES (" . implode(",", $vals) . ")"
    606                 );
     818
     819                if ($this->dumpSettings['complete-insert']) {
     820                    $lineSize += $this->compressManager->write(
     821                        "INSERT INTO `$tableName` (`" .
     822                        implode("`, `", array_keys($this->tableColumnTypes[$tableName])) .
     823                        "`) VALUES (" . implode(",", $vals) . ")"
     824                    );
     825                } else {
     826                    $lineSize += $this->compressManager->write(
     827                        "INSERT INTO `$tableName` VALUES (" . implode(",", $vals) . ")"
     828                    );
     829                }
    607830                $onlyOnce = false;
    608831            } else {
     
    7901013    }
    7911014
     1015    /**
     1016     * @param string $filename
     1017     */
    7921018    public function open($filename)
    7931019    {
     
    8251051    }
    8261052
     1053    /**
     1054     * @param string $filename
     1055     */
    8271056    public function open($filename)
    8281057    {
     
    8531082    private $fileHandler = null;
    8541083
     1084    /**
     1085     * @param string $filename
     1086     */
    8551087    public function open($filename)
    8561088    {
     
    9771209    }
    9781210
     1211    /**
     1212     * function create_procedure Modify procedure code, add delimiters, etc
     1213     * @todo make it do something with sqlite
     1214     */
     1215    public function create_procedure($procedureName, $dumpSettings)
     1216    {
     1217        return "";
     1218    }
     1219
    9791220    public function show_tables()
    9801221    {
     
    10011242
    10021243        return "pragma table_info(${args[0]})";
     1244    }
     1245
     1246    public function show_procedures()
     1247    {
     1248        return "";
    10031249    }
    10041250
     
    11411387            'binary',
    11421388            'varbinary',
    1143             'bit'
     1389            'bit',
     1390            'geometry', /* http://bugs.mysql.com/bug.php?id=43544 */
     1391            'point',
     1392            'linestring',
     1393            'polygon',
     1394            'multipoint',
     1395            'multilinestring',
     1396            'multipolygon',
     1397            'geometrycollection',
    11441398        )
    11451399    );
     
    11521406    public function databases()
    11531407    {
    1154         if (func_num_args() != 1) {
    1155             throw new Exception("Unexpected parameter passed to " . __METHOD__);
    1156         }
    1157 
     1408        $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
    11581409        $args = func_get_args();
    11591410        $databaseName = $args[0];
     
    11891440    {
    11901441        return "SHOW CREATE TRIGGER `$triggerName`";
     1442    }
     1443
     1444    public function show_create_procedure($procedureName)
     1445    {
     1446        return "SHOW CREATE PROCEDURE `$procedureName`";
    11911447    }
    11921448
     
    12131469
    12141470        $triggerStmt = $row['Create View'];
     1471
    12151472        $triggerStmtReplaced1 = str_replace(
    12161473            "CREATE ALGORITHM",
     
    12681525    }
    12691526
     1527    public function create_procedure($row, $dumpSettings)
     1528    {
     1529        $ret = "";
     1530        if (!isset($row['Create Procedure'])) {
     1531            throw new Exception("Error getting procedure code, unknown output. " .
     1532                "Please check 'https://bugs.mysql.com/bug.php?id=14564'");
     1533        }
     1534        $procedureStmt = $row['Create Procedure'];
     1535
     1536        $ret .= "/*!50003 DROP PROCEDURE IF EXISTS `" .
     1537            $row['Procedure'] . "` */;" . PHP_EOL .
     1538            "/*!40101 SET @saved_cs_client     = @@character_set_client */;" . PHP_EOL .
     1539            "/*!40101 SET character_set_client = " . $dumpSettings['default-character-set'] . " */;" . PHP_EOL .
     1540            "DELIMITER ;;" . PHP_EOL .
     1541            $procedureStmt . " ;;" . PHP_EOL .
     1542            "DELIMITER ;" . PHP_EOL .
     1543            "/*!40101 SET character_set_client = @saved_cs_client */;" . PHP_EOL . PHP_EOL;
     1544
     1545        return $ret;
     1546    }
     1547
    12701548    public function show_tables()
    12711549    {
    1272         if (func_num_args() != 1) {
    1273             return "";
    1274         }
    1275 
     1550        $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
    12761551        $args = func_get_args();
    1277 
    12781552        return "SELECT TABLE_NAME AS tbl_name " .
    12791553            "FROM INFORMATION_SCHEMA.TABLES " .
     
    12831557    public function show_views()
    12841558    {
    1285         if (func_num_args() != 1) {
    1286             return "";
    1287         }
    1288 
     1559        $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
    12891560        $args = func_get_args();
    1290 
    12911561        return "SELECT TABLE_NAME AS tbl_name " .
    12921562            "FROM INFORMATION_SCHEMA.TABLES " .
     
    12961566    public function show_triggers()
    12971567    {
    1298         if (func_num_args() != 1) {
    1299             return "";
    1300         }
    1301 
     1568        $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
    13021569        $args = func_get_args();
    1303 
    13041570        return "SHOW TRIGGERS FROM `${args[0]}`;";
    13051571    }
    13061572
    1307 
    13081573    public function show_columns()
    13091574    {
    1310         if (func_num_args() != 1) {
    1311             return "";
    1312         }
    1313 
     1575        $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
    13141576        $args = func_get_args();
    1315 
    13161577        return "SHOW COLUMNS FROM `${args[0]}`;";
    13171578    }
    13181579
     1580    public function show_procedures()
     1581    {
     1582        $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
     1583        $args = func_get_args();
     1584        return "SELECT SPECIFIC_NAME AS procedure_name " .
     1585            "FROM INFORMATION_SCHEMA.ROUTINES " .
     1586            "WHERE ROUTINE_TYPE='PROCEDURE' AND ROUTINE_SCHEMA='${args[0]}'";
     1587    }
     1588
    13191589    public function setup_transaction()
    13201590    {
     
    13341604    public function lock_table()
    13351605    {
    1336         if (func_num_args() != 1) {
    1337             return "";
    1338         }
    1339 
     1606        $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
    13401607        $args = func_get_args();
    1341         //$tableName = $args[0];
    1342         //return "LOCK TABLES `$tableName` READ LOCAL";
    13431608        return $this->dbHandler->exec("LOCK TABLES `${args[0]}` READ LOCAL");
    13441609
     
    13521617    public function start_add_lock_table()
    13531618    {
    1354         if (func_num_args() != 1) {
    1355             return "";
    1356         }
    1357 
     1619        $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
    13581620        $args = func_get_args();
    13591621
     
    13681630    public function start_add_disable_keys()
    13691631    {
    1370         if (func_num_args() != 1) {
    1371             return "";
    1372         }
     1632        $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
    13731633        $args = func_get_args();
    13741634        return "/*!40000 ALTER TABLE `${args[0]}` DISABLE KEYS */;" .
     
    13781638    public function end_add_disable_keys()
    13791639    {
    1380         if (func_num_args() != 1) {
    1381             return "";
    1382         }
     1640        $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
    13831641        $args = func_get_args();
    13841642        return "/*!40000 ALTER TABLE `${args[0]}` ENABLE KEYS */;" .
     
    13981656    public function add_drop_database()
    13991657    {
    1400         if (func_num_args() != 1) {
    1401              return "";
    1402         }
    1403 
     1658        $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
    14041659        $args = func_get_args();
    14051660
     
    14101665    public function add_drop_trigger()
    14111666    {
    1412         if (func_num_args() != 1) {
    1413             return "";
    1414         }
    1415 
     1667        $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
    14161668        $args = func_get_args();
    1417 
    14181669        return "DROP TRIGGER IF EXISTS `${args[0]}`;" . PHP_EOL;
    14191670    }
     
    14211672    public function drop_table()
    14221673    {
    1423         if (func_num_args() != 1) {
    1424             return "";
    1425         }
    1426 
     1674        $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
    14271675        $args = func_get_args();
    1428 
    14291676        return "DROP TABLE IF EXISTS `${args[0]}`;" . PHP_EOL;
    14301677    }
     
    14321679    public function drop_view()
    14331680    {
    1434         if (func_num_args() != 1) {
    1435             return "";
    1436         }
    1437 
     1681        $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
    14381682        $args = func_get_args();
    1439 
    14401683        return "DROP TABLE IF EXISTS `${args[0]}`;" . PHP_EOL .
    14411684                "/*!50001 DROP VIEW IF EXISTS `${args[0]}`*/;" . PHP_EOL;
     
    14441687    public function getDatabaseHeader()
    14451688    {
    1446         if (func_num_args() != 1) {
    1447             return "";
    1448         }
    1449 
     1689        $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
    14501690        $args = func_get_args();
    1451 
    14521691        return "--" . PHP_EOL .
    14531692            "-- Current Database: `${args[0]}`" . PHP_EOL .
     
    14851724    public function backup_parameters()
    14861725    {
    1487         if (func_num_args() != 1) {
    1488             throw new Exception("Unexpected parameter passed to " . __METHOD__);
    1489         }
    1490 
     1726        $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
    14911727        $args = func_get_args();
    14921728        $dumpSettings = $args[0];
     
    14961732            "/*!40101 SET NAMES " . $dumpSettings['default-character-set'] . " */;" . PHP_EOL;
    14971733
    1498         if (false === $dumpSettings['skip-tz-utz']) {
     1734        if (false === $dumpSettings['skip-tz-utc']) {
    14991735            $ret .= "/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;" . PHP_EOL .
    15001736                "/*!40103 SET TIME_ZONE='+00:00' */;" . PHP_EOL;
     
    15111747    public function restore_parameters()
    15121748    {
    1513         if (func_num_args() != 1) {
    1514             throw new Exception("Unexpected parameter passed to " . __METHOD__);
    1515         }
    1516 
     1749        $this->check_parameters(func_num_args(), $expected_num_args = 1, __METHOD__);
    15171750        $args = func_get_args();
    15181751        $dumpSettings = $args[0];
    15191752        $ret = "";
    15201753
    1521         if (false === $dumpSettings['skip-tz-utz']) {
     1754        if (false === $dumpSettings['skip-tz-utc']) {
    15221755            $ret .= "/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;" . PHP_EOL;
    15231756        }
     
    15331766        return $ret;
    15341767    }
     1768
     1769    private function check_parameters($num_args, $expected_num_args, $method_name)
     1770    {
     1771        if ( $num_args != $expected_num_args ) {
     1772            throw new Exception("Unexpected parameter passed to $method_name");
     1773        }
     1774        return;
     1775    }
    15351776}
  • _plugins_/migrateur/trunk/lib/mysqldump-php/tests/test.php

    r88450 r100602  
    1313
    1414$dumpSettings = array(
     15    'exclude-tables' => array('/^travis*/'),
    1516    'compress' => IMysqldump\Mysqldump::NONE,
    1617    'no-data' => false,
     
    2324    'skip-triggers' => false,
    2425    'add-drop-trigger' => true,
     26    'routines' => true,
    2527    'databases' => false,
    2628    'add-drop-database' => false,
     
    3133
    3234$dump = new IMysqldump\Mysqldump(
    33     "test001",
     35    "mysql:host=localhost;dbname=test001",
    3436    "travis",
    3537    "",
    36     "localhost:3306",
    37     "mysql",
    3838    $dumpSettings);
    3939
    4040$dump->start("mysqldump-php_test001.sql");
    4141
    42 
    4342$dumpSettings['default-character-set'] = IMysqldump\Mysqldump::UTF8MB4;
     43$dumpSettings['complete-insert'] = true;
    4444
    4545$dump = new IMysqldump\Mysqldump(
    46     "test002",
     46    "mysql:host=localhost;dbname=test002",
    4747    "travis",
    4848    "",
    49     "localhost",
    50     "mysql",
    5149    $dumpSettings);
    5250
    5351$dump->start("mysqldump-php_test002.sql");
    5452
     53$dumpSettings['complete-insert'] = false;
     54
     55$dump = new IMysqldump\Mysqldump(
     56    "mysql:unix_socket=/var/run/mysqld/mysqld.sock;dbname=test005",
     57    "travis",
     58    "",
     59    $dumpSettings);
     60
     61$dump->start("mysqldump-php_test005.sql");
     62
     63$dump = new IMysqldump\Mysqldump(
     64    "mysql:unix_socket=/var/run/mysqld/mysqld.sock;dbname=test006a",
     65    "travis",
     66    "",
     67    array("no-data" => true, "add-drop-table" => true));
     68
     69$dump->start("mysqldump-php_test006.sql");
     70
    5571exit;
  • _plugins_/migrateur/trunk/lib/mysqldump-php/tests/test.sh

    r88450 r100602  
    1313}
    1414
     15function checksum_test005() {
     16for i in 000; do
     17    mysql -B -e "CHECKSUM TABLE test${i}" test001 | grep -v -i checksum
     18done
     19}
     20
    1521for i in $(seq 0 20) ; do
    1622    ret[$i]=0
    1723done
    1824
     25index=0
     26
    1927mysql -e "CREATE USER 'travis'@'localhost' IDENTIFIED BY '';" 2> /dev/null
     28mysql -e "CREATE DATABASE test001;" 2> /dev/null
     29mysql -e "CREATE DATABASE test002;" 2> /dev/null
     30mysql -e "CREATE DATABASE test005;" 2> /dev/null
     31mysql -e "CREATE DATABASE test006a;" 2> /dev/null
     32mysql -e "CREATE DATABASE test006b;" 2> /dev/null
    2033mysql -e "GRANT ALL PRIVILEGES ON test001.* TO 'travis'@'localhost';" 2> /dev/null
     34mysql -e "GRANT SELECT ON mysql.proc to 'travis'@'localhost';" 2> /dev/null
    2135mysql -e "GRANT ALL PRIVILEGES ON test002.* TO 'travis'@'localhost';" 2> /dev/null
     36mysql -e "GRANT ALL PRIVILEGES ON test005.* TO 'travis'@'localhost';" 2> /dev/null
     37mysql -e "GRANT ALL PRIVILEGES ON test006a.* TO 'travis'@'localhost';" 2> /dev/null
     38mysql -e "GRANT ALL PRIVILEGES ON test00ba.* TO 'travis'@'localhost';" 2> /dev/null
     39mysql -e "FLUSH PRIVILEGES;" 2> /dev/null
    2240
    23 mysql -uroot < test001.src.sql; ret[0]=$?
    24 
    25 mysql -uroot --default-character-set=utf8mb4 < test002.src.sql; ret[1]=$?
     41mysql -uroot < test001.src.sql; ret[((index++))]=$?
     42mysql -uroot --default-character-set=utf8mb4 < test002.src.sql; ret[((index++))]=$?
     43mysql -uroot < test005.src.sql; ret[((index++))]=$?
     44mysql -uroot < test006.src.sql; ret[((index++))]=$?
    2645
    2746checksum_test001 > test001.src.checksum
    2847checksum_test002 > test002.src.checksum
     48checksum_test005 > test005.src.checksum
    2949
    3050mysqldump -uroot test001 \
     
    3252    --extended-insert=false \
    3353    --hex-blob=true \
     54    --routines=true \
    3455    > mysqldump_test001.sql
    35 ret[2]=$?
     56ret[((index++))]=$?
    3657
    3758mysqldump -uroot test002 \
    3859    --no-autocommit \
    3960    --extended-insert=false \
     61    --complete-insert=true \
    4062    --hex-blob=true \
    4163    --default-character-set=utf8mb4 \
    4264    > mysqldump_test002.sql
    43 ret[3]=$?
     65ret[((index++))]=$?
     66
     67mysqldump -uroot test005 \
     68    --no-autocommit \
     69    --extended-insert=false \
     70    --hex-blob=true \
     71    > mysqldump_test005.sql
     72ret[((index++))]=$?
    4473
    4574php test.php
    46 ret[4]=$?
     75ret[((index++))]=$?
    4776
    4877mysql -uroot test001 < mysqldump-php_test001.sql
    49 ret[5]=$?
     78ret[((index++))]=$?
    5079mysql -uroot test002 < mysqldump-php_test002.sql
    51 ret[6]=$?
     80ret[((index++))]=$?
     81mysql -uroot test005 < mysqldump-php_test005.sql
     82ret[((index++))]=$?
     83
     84mysql -uroot test006b < mysqldump-php_test006.sql
     85ret[((index++))]=$?
    5286
    5387checksum_test001 > mysqldump-php_test001.checksum
    5488checksum_test002 > mysqldump-php_test002.checksum
     89checksum_test005 > mysqldump-php_test005.checksum
    5590
    5691cat test001.src.sql | grep ^INSERT > test001.filtered.sql
    5792cat test002.src.sql | grep ^INSERT > test002.filtered.sql
     93cat test005.src.sql | grep ^INSERT > test005.filtered.sql
    5894cat mysqldump_test001.sql | grep ^INSERT > mysqldump_test001.filtered.sql
    5995cat mysqldump_test002.sql | grep ^INSERT > mysqldump_test002.filtered.sql
     96cat mysqldump_test005.sql | grep ^INSERT > mysqldump_test005.filtered.sql
    6097cat mysqldump-php_test001.sql | grep ^INSERT > mysqldump-php_test001.filtered.sql
    6198cat mysqldump-php_test002.sql | grep ^INSERT > mysqldump-php_test002.filtered.sql
     99cat mysqldump-php_test005.sql | grep ^INSERT > mysqldump-php_test005.filtered.sql
    62100
    63101diff test001.filtered.sql mysqldump_test001.filtered.sql
    64 ret[7]=$?
     102ret[((index++))]=$?
    65103diff test002.filtered.sql mysqldump_test002.filtered.sql
    66 ret[8]=$?
     104ret[((index++))]=$?
    67105
    68106diff test001.filtered.sql mysqldump-php_test001.filtered.sql
    69 ret[9]=$?
     107ret[((index++))]=$?
    70108diff test002.filtered.sql mysqldump-php_test002.filtered.sql
    71 ret[10]=$?
     109ret[((index++))]=$?
    72110
    73111diff test001.src.checksum mysqldump-php_test001.checksum
    74 ret[11]=$?
     112ret[((index++))]=$?
    75113diff test002.src.checksum mysqldump-php_test002.checksum
    76 ret[12]=$?
     114ret[((index++))]=$?
     115diff test005.src.checksum mysqldump-php_test005.checksum
     116ret[((index++))]=$?
    77117
     118diff mysqldump_test005.filtered.sql mysqldump-php_test005.filtered.sql
     119ret[((index++))]=$?
    78120rm *.checksum 2> /dev/null
    79121rm *.filtered.sql 2> /dev/null
    80122rm mysqldump* 2> /dev/null
     123
     124echo "Done $index tests"
    81125
    82126total=0
     
    85129done
    86130
     131echo "Exiting with code $total"
     132
    87133exit $total
  • _plugins_/migrateur/trunk/lib/mysqldump-php/tests/test001.src.sql

    r88450 r100602  
    127127
    128128-- INSERT INTO `test200` VALUES (1,1); -- trigger tests
     129
     130/*!50003 DROP PROCEDURE IF EXISTS `GetAllFromTest000` */;
     131DELIMITER //
     132CREATE PROCEDURE GetAllFromTest000()
     133BEGIN
     134SELECT * FROM test000;
     135END //
     136DELIMITER ;
  • _plugins_/migrateur/trunk/lib/mysqldump-php/tests/test002.src.sql

    r88450 r100602  
    88) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
    99
    10 INSERT INTO `test201` VALUES ('áéíóú');
    11 INSERT INTO `test201` VALUES ('🎲');
    12 INSERT INTO `test201` VALUES ('🎭');
    13 INSERT INTO `test201` VALUES ('💩');
    14 INSERT INTO `test201` VALUES ('🐈');
     10INSERT INTO `test201` (`col`) VALUES ('áéíóú');
     11INSERT INTO `test201` (`col`) VALUES ('🎲');
     12INSERT INTO `test201` (`col`) VALUES ('🎭');
     13INSERT INTO `test201` (`col`) VALUES ('💩');
     14INSERT INTO `test201` (`col`) VALUES ('🐈');
Note: See TracChangeset for help on using the changeset viewer.