src/Neevo/Manager.php
public function loadFile($filename){
		$this->connection->connect();
		$abort = ignore_user_abort();
		@set_time_limit(0);
		ignore_user_abort(true);

		$handle = @fopen($filename, 'r');
		if($handle === false){
			ignore_user_abort($abort);
			throw new NeevoException("Cannot open file '$filename' for SQL import.");
		}

		$sql = '';
		$count = 0;
		while(!feof($handle)){
			$content = fgets($handle);
			$sql .= $content;
			if(substr(rtrim($content), -1) === ';'){
				// Passed directly to driver without logging.
				$this->connection->getDriver()->runQuery($sql);
				$sql = '';
				$count++;
			}
		}
		if(trim($sql)){
			$this->connection->getDriver()->runQuery($sql);
			$count++;
		}
		fclose($handle);
		ignore_user_abort($abort);
		return $count;
	}
public function loadFile($filename){
		$this->connection->connect();
		$abort = ignore_user_abort();
		@set_time_limit(0);
		ignore_user_abort(true);

		$handle = @fopen($filename, 'r');
		if($handle === false){
			ignore_user_abort($abort);
			throw new NeevoException("Cannot open file '$filename' for SQL import.");
		}

		$sql = '';
		$count = 0;
		while(!feof($handle)){
			$content = fgets($handle);
			$sql .= $content;
			if(substr(rtrim($content), -1) === ';'){
				// Passed directly to driver without logging.
				$this->connection->getDriver()->runQuery($sql);
				$sql = '';
				$count++;
			}
		}
		if(trim($sql)){
			$this->connection->getDriver()->runQuery($sql);
			$count++;
		}
		fclose($handle);
		ignore_user_abort($abort);
		return $count;
	}
public function loadFile ( $ filename ) { $ this -> connection -> connect ( ) ; $ abort = ignore_user_abort ( ) ; @ set_time_limit ( 0 ) ; ignore_user_abort ( true ) ; $ handle = @ fopen ( $ filename , 'r' ) ; if ( $ handle === false ) { ignore_user_abort ( $ abort ) ; throw new NeevoException ( "Cannot open file '$filename' for SQL import." ) ; } $ sql = '' ; $ count = 0 ; while ( ! feof ( $ handle ) ) { $ content = fgets ( $ handle ) ; $ sql .= $ content ; if ( substr ( rtrim ( $ content ) , - 1 ) === ';' ) { // Passed directly to driver without logging. $ this -> connection -> getDriver ( ) -> runQuery ( $ sql ) ; $ sql = '' ; $ count ++ ; } } if ( trim ( $ sql ) ) { $ this -> connection -> getDriver ( ) -> runQuery ( $ sql ) ; $ count ++ ; } fclose ( $ handle ) ; ignore_user_abort ( $ abort ) ; return $ count ; }
Imports a SQL dump from given file.
Based on implementation in Nette\Database.
@copyright 2004 David Grudl, http://davidgrudl.com
@license New BSD license
@param string $filename
@return int Number of executed commands
Imports a SQL dump from given file . Based on implementation in Nette \ Database .