public function import($filename)
    {
        // TODO: Wrap this in a transaction!
        if (!file_exists($filename)) {
            throw new Exception("File not found: $filename");
        }

        $sql_queries = file_get_contents($filename);
        $sql_queries = $this->_removeRemarks($sql_queries);
        $sql_queries = StringUtils::smartSplit($sql_queries, ";", "'", "\\'");

        foreach ($sql_queries as $sql) {
            $sql = trim($sql); // Trim newlines so we don't have blank queries
            if (empty($sql))
                continue;
            $this->write($sql);
        }
    }
public function import($filename)
    {
        // TODO: Wrap this in a transaction!
        if (!file_exists($filename)) {
            throw new Exception("File not found: $filename");
        }

        $sql_queries = file_get_contents($filename);
        $sql_queries = $this->_removeRemarks($sql_queries);
        $sql_queries = StringUtils::smartSplit($sql_queries, ";", "'", "\\'");

        foreach ($sql_queries as $sql) {
            $sql = trim($sql); // Trim newlines so we don't have blank queries
            if (empty($sql))
                continue;
            $this->write($sql);
        }
    }
public function import ( $ filename ) { // TODO: Wrap this in a transaction! if ( ! file_exists ( $ filename ) ) { throw new Exception ( "File not found: $filename" ) ; } $ sql_queries = file_get_contents ( $ filename ) ; $ sql_queries = $ this -> _removeRemarks ( $ sql_queries ) ; $ sql_queries = StringUtils :: smartSplit ( $ sql_queries , ";" , "'" , "\\'" ) ; foreach ( $ sql_queries as $ sql ) { $ sql = trim ( $ sql ) ; // Trim newlines so we don't have blank queries if ( empty ( $ sql ) ) continue ; $ this -> write ( $ sql ) ; } }
Imports and runs sql contained in the specified file.
The file must contain only valid sql.

@param string $filename The filename to load

@return void
Imports and runs sql contained in the specified file . The file must contain only valid sql .