library/Services/Library/DatabaseHandler.php
public function import($sqlFile, $charsetMode = null)
    {
        if (!file_exists($sqlFile)) {
            throw new Exception("File '$sqlFile' was not found.");
        }

        $credentialsFile = $this->databaseDefaultsFileGenerator->generate();
        $charsetMode = $charsetMode ? $charsetMode : $this->getCharsetMode();
        $command = 'mysql --defaults-file=' . $credentialsFile;
        $command .= ' --default-character-set=' . $charsetMode;
        $command .= ' ' .escapeshellarg($this->getDbName());
        $command .= ' < ' . escapeshellarg($sqlFile);
        $this->executeCommand($command);
        unlink($credentialsFile);
    }
public function import($sqlFile, $charsetMode = null)
    {
        if (!file_exists($sqlFile)) {
            throw new Exception("File '$sqlFile' was not found.");
        }

        $credentialsFile = $this->databaseDefaultsFileGenerator->generate();
        $charsetMode = $charsetMode ? $charsetMode : $this->getCharsetMode();
        $command = 'mysql --defaults-file=' . $credentialsFile;
        $command .= ' --default-character-set=' . $charsetMode;
        $command .= ' ' .escapeshellarg($this->getDbName());
        $command .= ' < ' . escapeshellarg($sqlFile);
        $this->executeCommand($command);
        unlink($credentialsFile);
    }
public function import ( $ sqlFile , $ charsetMode = null ) { if ( ! file_exists ( $ sqlFile ) ) { throw new Exception ( "File '$sqlFile' was not found." ) ; } $ credentialsFile = $ this -> databaseDefaultsFileGenerator -> generate ( ) ; $ charsetMode = $ charsetMode ? $ charsetMode : $ this -> getCharsetMode ( ) ; $ command = 'mysql --defaults-file=' . $ credentialsFile ; $ command .= ' --default-character-set=' . $ charsetMode ; $ command .= ' ' . escapeshellarg ( $ this -> getDbName ( ) ) ; $ command .= ' < ' . escapeshellarg ( $ sqlFile ) ; $ this -> executeCommand ( $ command ) ; unlink ( $ credentialsFile ) ; }
Execute sql statements from sql file

@param string $sqlFile     SQL File name to import.
@param string $charsetMode Charset of imported file. Will use shop charset mode if not set.

@throws Exception
Execute sql statements from sql file