Chyrp

Query

Handles a query based on the <SQL.method>.

Summary
Query Handles a query based on the <SQL.method>.
Variables
$query Holds the current query.
Functions
__construct Creates a query based on the <SQL.interface>.
fetchColumn Fetches a column of the current row.
fetch Returns the current row as an array.
fetchObject Returns the current row as an object.
fetchAll Returns an array of every result.
grab Grabs all of the given column out of the full result of a query.
handle Handles exceptions thrown by failed queries.

Variables

$query

public $query

Holds the current query.

Functions

__construct

public function __construct( $sql,   
$query,   
$params  =  array(),
$throw_exceptions  =  false )

Creates a query based on the <SQL.interface>.

Parameters

$sql SQL instance.
$query Query to execute.
$params An associative array of parameters used in the query.
$throw_exceptions Throw exceptions on error?

fetchColumn

public function fetchColumn( $column  =  0 )

Fetches a column of the current row.

Parameters

$column The offset of the column to grab.  Default 0.

fetch

public function fetch()

Returns the current row as an array.

fetchObject

public function fetchObject()

Returns the current row as an object.

fetchAll

public function fetchAll( $style  =  null )

Returns an array of every result.

grab

public function grab( $column )

Grabs all of the given column out of the full result of a query.

Parameters

$column Name of the column to grab.

Returns

An array of all of the values of that column in the result.

handle

public function handle( $error )

Handles exceptions thrown by failed queries.