src/Database/Drivers/ImprovedDriver.php
/**
	 * Executes a prepared statement on the database server and returns the results.
	 *
	 * @param string $statement
	 * @param array $bindings
	 * @return int|array|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|array|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|array|bool @throws DatabaseException on error
protected function prepared($statement, array &$bindings = array()) {
		if ($p = $this->handle->prepare($statement)) {
			$types = StringBuilder::generateTypes($bindings);
			$parameters = array($types);
			foreach ($bindings as $key => $value) {
				$parameters[] = &$bindings[$key];
			}
			call_user_func_array(array($p, 'bind_param'), $parameters);
			$p->execute();
			if ($p->error) {
				throw new DatabaseException(sprintf('Prepared statement errored: %s', $p->error));
			}
			$returnValue = $this->getPreparedResults($p, $statement);
			$p->close();
			return $returnValue;
		}
		else {
			throw new DatabaseException(sprintf('Prepared statement failed: %s', $this->handle->error));
		}
	}
protected function prepared ( $ statement , array & $ bindings = array ( ) ) { if ( $ p = $ this -> handle -> prepare ( $ statement ) ) { $ types = StringBuilder :: generateTypes ( $ bindings ) ; $ parameters = array ( $ types ) ; foreach ( $ bindings as $ key => $ value ) { $ parameters [ ] = & $ bindings [ $ key ] ; } call_user_func_array ( array ( $ p , 'bind_param' ) , $ parameters ) ; $ p -> execute ( ) ; if ( $ p -> error ) { throw new DatabaseException ( sprintf ( 'Prepared statement errored: %s' , $ p -> error ) ) ; } $ returnValue = $ this -> getPreparedResults ( $ p , $ statement ) ; $ p -> close ( ) ; return $ returnValue ; } else { throw new DatabaseException ( sprintf ( 'Prepared statement failed: %s' , $ this -> handle -> error ) ) ; } }
Executes a prepared statement on the database server and returns the results.
Executes a prepared statement on the database server and returns the results .
// Get references to the parameters // Bind the parameters // Execute the query // Handle errors