public function import($sql, $force_engine = false)
    {
        if ($force_engine) {
            // Silently attempt to change the storage engine. This prevents INNOdb errors.
            $this->query('SET default_storage_engine = MYISAM');
        }

        $queries = preg_split('/;[\\r\\n]+/', $sql, -1, PREG_SPLIT_NO_EMPTY);

        if (!is_array($queries) || empty($queries) || count($queries) <= 0) {
            throw new Exception('The SQL string contains no queries.');
        }

        foreach ($queries as $sql) {
            if (trim($sql) !== '') {
                $result = $this->query($sql);
            }

            if (!$result) {
                return false;
            }
        }

        return true;
    }
public function import($sql, $force_engine = false)
    {
        if ($force_engine) {
            // Silently attempt to change the storage engine. This prevents INNOdb errors.
            $this->query('SET default_storage_engine = MYISAM');
        }

        $queries = preg_split('/;[\\r\\n]+/', $sql, -1, PREG_SPLIT_NO_EMPTY);

        if (!is_array($queries) || empty($queries) || count($queries) <= 0) {
            throw new Exception('The SQL string contains no queries.');
        }

        foreach ($queries as $sql) {
            if (trim($sql) !== '') {
                $result = $this->query($sql);
            }

            if (!$result) {
                return false;
            }
        }

        return true;
    }
public function import ( $ sql , $ force_engine = false ) { if ( $ force_engine ) { // Silently attempt to change the storage engine. This prevents INNOdb errors. $ this -> query ( 'SET default_storage_engine = MYISAM' ) ; } $ queries = preg_split ( '/;[\\r\\n]+/' , $ sql , - 1 , PREG_SPLIT_NO_EMPTY ) ; if ( ! is_array ( $ queries ) || empty ( $ queries ) || count ( $ queries ) <= 0 ) { throw new Exception ( 'The SQL string contains no queries.' ) ; } foreach ( $ queries as $ sql ) { if ( trim ( $ sql ) !== '' ) { $ result = $ this -> query ( $ sql ) ; } if ( ! $ result ) { return false ; } } return true ; }
Convenience function to allow you to execute multiple SQL queries at once
by providing a string with the queries delimited with a `;`

@throws DatabaseException
@throws Exception
@param string $sql
A string containing SQL queries delimited by `;`
@param boolean $force_engine
If set to true, this will set MySQL's default storage engine to MyISAM.
Defaults to false, which will use MySQL's default storage engine when
tables don't explicitly define which engine they should be created with
@return boolean
If one of the queries fails, false will be returned and no further queries
will be executed, otherwise true will be returned.
Convenience function to allow you to execute multiple SQL queries at once by providing a string with the queries delimited with a ;