src/Database/Drivers/PdoDriver.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);
		}
		try {
			$type = $this->getQueryType($statement);
			$query = $this->handle->$type($statement);
		}
		catch (PDOException $e) {
			throw new DatabaseException(sprintf('Query error: %s', $this->handle->errorInfo()[2]));
		}
		if (!is_object($query) && is_numeric($query)) {
			if (Str::startsWith(strtolower($statement), 'insert into')) return $this->handle->lastInsertId();
			if (Str::startsWith(strtolower($statement), 'create ')) return true;
			if (Str::startsWith(strtolower($statement), 'alter ')) return true;
			return $query;
		}
		return $query->fetchAll(PDO::FETCH_OBJ);
	}
public function query ( $ statement , $ bindings = null ) { $ this -> connect ( ) ; $ statement = trim ( $ statement ) ; if ( is_array ( $ bindings ) && ! empty ( $ bindings ) ) { return $ this -> prepared ( $ statement , $ bindings ) ; } try { $ type = $ this -> getQueryType ( $ statement ) ; $ query = $ this -> handle -> $ type ( $ statement ) ; } catch ( PDOException $ e ) { throw new DatabaseException ( sprintf ( 'Query error: %s' , $ this -> handle -> errorInfo ( ) [ 2 ] ) ) ; } if ( ! is_object ( $ query ) && is_numeric ( $ query ) ) { if ( Str :: startsWith ( strtolower ( $ statement ) , 'insert into' ) ) return $ this -> handle -> lastInsertId ( ) ; if ( Str :: startsWith ( strtolower ( $ statement ) , 'create ' ) ) return true ; if ( Str :: startsWith ( strtolower ( $ statement ) , 'alter ' ) ) return true ; return $ query ; } return $ query -> fetchAll ( PDO :: FETCH_OBJ ) ; }
Executes a query on the database server and returns the results.
Executes a query on the database server and returns the results .