src/Database/Drivers/LegacyDriver.php
/**
	 * Executes a query on the database server and returns the results.
	 *
	 * @param string $statement
	 * @param array $bindings
	 * @return int|object|bool
	 *
	 * @throws DatabaseException on error
	 */
Executes a query on the database server and returns the results.
@param string $statement
@param array $bindings
@return int|object|bool

@throws DatabaseException on error
Executes a query on the database server and returns the results . @param string $statement @param array $bindings @return int|object|bool @throws DatabaseException on error
public function query($statement, $bindings = null) {
		$this->connect();
		$statement = trim($statement);
		if (is_array($bindings) && !empty($bindings)) {
			return $this->prepared($statement, $bindings);
		}
		$query = @mysql_query($statement, $this->handle);
		if ($query === false) {
			throw new DatabaseException(sprintf('Query error: %s', mysql_error($this->handle)));
		}
		if ($query === true) {
			if (Str::startsWith(strtolower($statement), 'insert into')) return mysql_insert_id($this->handle);
			if (Str::startsWith(strtolower($statement), 'create ')) return true;
			if (Str::startsWith(strtolower($statement), 'alter ')) return true;
			return mysql_affected_rows($this->handle);
		}
		$rows = array();
		while ($row = mysql_fetch_object($query)) {
			$rows[] = $row;
		}
		return $rows;
	}
public function query ( $ statement , $ bindings = null ) { $ this -> connect ( ) ; $ statement = trim ( $ statement ) ; if ( is_array ( $ bindings ) && ! empty ( $ bindings ) ) { return $ this -> prepared ( $ statement , $ bindings ) ; } $ query = @ mysql_query ( $ statement , $ this -> handle ) ; if ( $ query === false ) { throw new DatabaseException ( sprintf ( 'Query error: %s' , mysql_error ( $ this -> handle ) ) ) ; } if ( $ query === true ) { if ( Str :: startsWith ( strtolower ( $ statement ) , 'insert into' ) ) return mysql_insert_id ( $ this -> handle ) ; if ( Str :: startsWith ( strtolower ( $ statement ) , 'create ' ) ) return true ; if ( Str :: startsWith ( strtolower ( $ statement ) , 'alter ' ) ) return true ; return mysql_affected_rows ( $ this -> handle ) ; } $ rows = array ( ) ; while ( $ row = mysql_fetch_object ( $ query ) ) { $ rows [ ] = $ row ; } return $ rows ; }
Executes a query on the database server and returns the results.
Executes a query on the database server and returns the results .