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

@throws DatabaseException on error
Executes a prepared statement on the database server and returns the results . @param string $statement @param array $bindings @return int|object|bool @throws DatabaseException on error
protected function prepared($statement, array &$bindings = array()) {
		$type = $this->getQueryType($statement);
		try {
			$p = $this->handle->prepare($statement);
		} catch (PDOException $e) {
			throw new DatabaseException(sprintf('Prepared statement failed: %s', $this->handle->errorInfo()[2]));
		}
		try {
			$p->execute($bindings);
		} catch (PDOException $e) {
			throw new DatabaseException(sprintf('Prepared statement errored: %s', $p->errorInfo()[2]));
		}
		if ($type == 'query') {
			return $p->fetchAll(PDO::FETCH_OBJ);
		}
		else {
			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 $p->rowCount();
		}
	}
protected function prepared ( $ statement , array & $ bindings = array ( ) ) { $ type = $ this -> getQueryType ( $ statement ) ; try { $ p = $ this -> handle -> prepare ( $ statement ) ; } catch ( PDOException $ e ) { throw new DatabaseException ( sprintf ( 'Prepared statement failed: %s' , $ this -> handle -> errorInfo ( ) [ 2 ] ) ) ; } try { $ p -> execute ( $ bindings ) ; } catch ( PDOException $ e ) { throw new DatabaseException ( sprintf ( 'Prepared statement errored: %s' , $ p -> errorInfo ( ) [ 2 ] ) ) ; } if ( $ type == 'query' ) { return $ p -> fetchAll ( PDO :: FETCH_OBJ ) ; } else { 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 $ p -> rowCount ( ) ; } }
Executes a prepared statement on the database server and returns the results.
Executes a prepared statement on the database server and returns the results .