Implementation of a query, specific to the MySQL driver.

see \global\WebLab_Data_Query
author Jorgen Evens
package WebLab
subpackage Data_MySQL

 Methods

Default constructor.

__construct(\WebLab_Data_Adapter $adapter) 
Inherited

Sets the optional database adapter if supplied.

inherited_from \WebLab_Data_Query::__construct()

Parameters

Add a table to the query.

addTable(\WebLab_Data_Table | String $table) : \WebLab_Data_Table
Inherited
inherited_from \WebLab_Data_Query::addTable()

Parameters

$table

\WebLab_Data_TableString

Returns

Add multiple tables to the query.

addTables() : \WebLab_Data_Query
Inherited

This equals the FROM statement.

see \addTable()
inherited_from \WebLab_Data_Query::addTables()

Returns

Retrieve a builder instance for this query, this method ensures lazy loading.

builder() : \WebLab_Data_MySQLi_QueryBuilder

Returns

\WebLab_Data_MySQLi_QueryBuilderA builder to be used for this query instance.

Remove limit from query.

clearLimit() 
Inherited
inherited_from \WebLab_Data_Query::clearLimit()

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

countLimitless(boolean $count) 
Inherited

Special option, might not work in every implementation.

inherited_from \WebLab_Data_Query::countLimitless()

Parameters

$count

boolean

Performs a DELETE query on the underlying database.

delete() : \WebLab_Data_MySQLi_Result

The query is created using a QueryBuilder that converts this query object into a statement.

Returns

Get the database adapter currently in use.

getAdapter() : \WebLab_Data_Adapter
Inherited
inherited_from \WebLab_Data_Query::getAdapter()

Returns

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

getCountLimitless() : boolean
Inherited
see \countLimitLess
inherited_from \WebLab_Data_Query::getCountLimitless()

Exceptions

\WebLab_Exception_Data

Returns

boolean

Gets the criteriachain for this query.

getCriteria() : \WebLab_Data_CriteriaChain
Inherited

Criteria chain equals the WHERE statement in a query.

inherited_from \WebLab_Data_Query::getCriteria()

Returns

Gets the criteriachain for this query.

getCriteriaChain() : \WebLab_Data_CriteriaChain
Inherited

Criteria chain equals the WHERE statement in a query.

see \getCriteria()
inherited_from \WebLab_Data_Query::getCriteriaChain()

Returns

Gets the criteriachain for this query.

getHaving() : \WebLab_Data_CriteriaChain
Inherited

Criteria chain equals the HAVING statement in a query.

inherited_from \WebLab_Data_Query::getHaving()

Returns

Get the limit that has been set on this query.

getLimit() : mixed
Inherited
inherited_from \WebLab_Data_Query::getLimit()

Returns

mixedAn object with keys count and start.

Get a table instance by it's name.

getTable(String $table) : \WebLab_Data_Table
Inherited
inherited_from \WebLab_Data_Query::getTable()

Parameters

$table

String

Returns

Get all table instances in this query.

getTables() : \WebLab_Data_Table[]
Inherited
inherited_from \WebLab_Data_Query::getTables()

Returns

Performs an INSERT query on the underlying database.

insert(boolean $update, mixed $ignoreInUpdate) : \WebLab_Data_MySQLi_Result

The query is created using a QueryBuilder that converts this query object into a statement.

Parameters

$update

boolean

Should the record be updated if it already exists. ( uses ON DUPLICATE KEY syntax )

$ignoreInUpdate

mixed

Fields not to update if $update is set to true.

Returns

Remove a table from the query.

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

Parameters

$table

\WebLab_Data_TableString

Returns

Performs a SELECT query on the underlying database.

select() : \WebLab_Data_MySQLi_Result

The query is created using a QueryBuilder that converts this query object into a statement.

Returns

Set the database adapter to use.

setAdapter(\WebLab_Data_Adapter $adapter) 
Inherited
inherited_from \WebLab_Data_Query::setAdapter()

Parameters

Set a limit on the query.

setLimit(int $count, int $start) 
Inherited

MySQL: LIMIT MSSQL: TOP

inherited_from \WebLab_Data_Query::setLimit()

Parameters

$count

int

$start

int

Exceptions

\WebLab_Exception_Data

Performs an UPDATE query on the underlying database.

update() : \WebLab_Data_MySQLi_Result

The query is created using a QueryBuilder that converts this query object into a statement.

Returns

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

_isConnected() : boolean
Inherited
inherited_from \WebLab_Data_Query::_isConnected()

Exceptions

\WebLab_Exception_Data

Returns

boolean

 Properties

 

$_last_query : string
Inherited
inherited_from \WebLab_Data_Query::$$_last_query
 

$_adapter : \WebLab_Data_Adapter
Inherited
inherited_from \WebLab_Data_Query::$$_adapter
   

$_count_limitless : boolean
Inherited
inherited_from \WebLab_Data_Query::$$_count_limitless
 

$_criteriaChain : \WebLab_Data_CriteriaChain
Inherited

This is used to build the WHERE statement.

inherited_from \WebLab_Data_Query::$$_criteriaChain
 

$_havingChain : \WebLab_Data_CriteriaChain
Inherited

This is used to build the HAVING statement.

inherited_from \WebLab_Data_Query::$$_havingChain
 

$_limit : object
Inherited
inherited_from \WebLab_Data_Query::$$_limit
 

$_tables : \WebLab_Data_Table[]
Inherited
inherited_from \WebLab_Data_Query::$$_tables