Abstract representation of a query to the database.

author Jorgen Evens
package WebLab
subpackage Data

 Methods

Default constructor.

__construct(\WebLab_Data_Adapter $adapter) 

Sets the optional database adapter if supplied.

Parameters

Add a table to the query.

addTable(\WebLab_Data_Table | String $table) : \WebLab_Data_Table

Parameters

$table

\WebLab_Data_TableString

Returns

Add multiple tables to the query.

addTables() : \WebLab_Data_Query

This equals the FROM statement.

see \addTable()

Returns

Remove limit from query.

clearLimit() 

Force query to calcuate the length of the result without a limit.

countLimitless(boolean $count) 

Special option, might not work in every implementation.

Parameters

$count

boolean

Execute this query with a DELETE statement.

delete() : \WebLab_Data_Result

Get the database adapter currently in use.

getAdapter() : \WebLab_Data_Adapter

Returns if this query is forced to load the entire length.

getCountLimitless() : boolean
see \countLimitLess

Exceptions

\WebLab_Exception_Data

Returns

boolean

Gets the criteriachain for this query.

getCriteria() : \WebLab_Data_CriteriaChain

Criteria chain equals the WHERE statement in a query.

Returns

Gets the criteriachain for this query.

getCriteriaChain() : \WebLab_Data_CriteriaChain

Criteria chain equals the WHERE statement in a query.

see \getCriteria()
deprecated

Returns

Gets the criteriachain for this query.

getHaving() : \WebLab_Data_CriteriaChain

Criteria chain equals the HAVING statement in a query.

Returns

Get the limit that has been set on this query.

getLimit() : mixed

Returns

mixedAn object with keys count and start.

Get a table instance by it's name.

getTable(String $table) : \WebLab_Data_Table

Parameters

$table

String

Returns

Get all table instances in this query.

getTables() : \WebLab_Data_Table[]

Execute this query with a INSERT statement.

insert() : \WebLab_Data_Result

Remove a table from the query.

removeTable(\WebLab_Data_Table | String $table) : \WebLab_Data_Query

Parameters

$table

\WebLab_Data_TableString

Returns

Execute this query with a SELECT statement.

select() : \WebLab_Data_Result

Set the database adapter to use.

setAdapter(\WebLab_Data_Adapter $adapter) 

Parameters

Set a limit on the query.

setLimit(int $count, int $start) 

MySQL: LIMIT MSSQL: TOP

Parameters

$count

int

$start

int

Exceptions

\WebLab_Exception_Data

Execute this query with a UPDATE statement.

update() : \WebLab_Data_Result

Check if the query has access to an active database connection.

_isConnected() : boolean

Exceptions

\WebLab_Exception_Data

Returns

boolean

 Properties

 

$_last_query : string
 

$_adapter : \WebLab_Data_Adapter
 

$_count_limitless : boolean
 

$_criteriaChain : \WebLab_Data_CriteriaChain

This is used to build the WHERE statement.

 

$_havingChain : \WebLab_Data_CriteriaChain

This is used to build the HAVING statement.

 

$_limit : object
 

$_tables : \WebLab_Data_Table[]