Zeta Components - high quality PHP components

Zeta Components Manual :: Docs For Class ezcQuerySelectSqlite

Database::ezcQuerySelectSqlite

Class ezcQuerySelectSqlite

SQLite specific implementation of ezcQuery.

This class reimplements methods where SQLite differs from the standard implementation in ezcQuery. The only difference is the right join syntax.

Source for this file: /Database/src/sqlabstraction/implementations/query_select_sqlite.php

ezcQuery
   |
   --ezcQuerySelect
      |
      --ezcQuerySelectSqlite
Version:   //autogentag//

Inherited Constants

From ezcQuerySelect:
ezcQuerySelect::ASC    Sort the result ascending.
ezcQuerySelect::DESC    Sort the result descending.

Member Variables

protected mixed $fromTables = array()
Store tables that appear in FROM clause.

Used for building fromString every time when it requested

protected mixed $rightJoins = array( null )
Store info for building emulation of right joins in FROM clause.

This array contains null if there was no calls to rightJoin(). When call to rightJoin() occurs an item of right join info added. Right join info is array that consists of two arrays: 'tables' and 'conditions'. These arrays filled with values from parameters of rightJoin(). If from() was called then new right join info item added to $rightJoins.

Inherited Member Variables

From ezcQuerySelect
protected ezcQuerySelect::$fromString
protected ezcQuerySelect::$groupString
protected ezcQuerySelect::$havingString
protected ezcQuerySelect::$lastInvokedMethod
protected ezcQuerySelect::$limitString
protected ezcQuerySelect::$orderString
protected ezcQuerySelect::$selectString
protected ezcQuerySelect::$whereString
From ezcQuery
protected ezcQuery::$db
public ezcQuery::$expr

Method Summary

public ezcQuerySelectSqlite __construct( $db )
Constructs a new ezcQuerySelectSqlite object.
public a from( $... )
Select which tables you want to select from.
public void reset( )
Resets the query object for reuse.
public ezcQuery rightJoin( $table2,... )
Returns the SQL for a right join or prepares $fromString for a right join.

Inherited Methods

From ezcQuerySelect
public ezcQuerySelect ezcQuerySelect::__construct()
Constructs a new ezcQuery object.
public string ezcQuerySelect::alias()
Returns SQL to create an alias
protected ezcQuery ezcQuerySelect::doJoin()
Returns the SQL for a join or prepares $fromString for a join.
public ezcQuery ezcQuerySelect::from()
Select which tables you want to select from.
public static bool|string ezcQuerySelect::getDummyTableName()
Returns dummy table name.
public string ezcQuerySelect::getQuery()
Returns the complete select query string.
public ezcQuery ezcQuerySelect::groupBy()
Returns SQL that groups the result set by a given column.
public ezcQuery ezcQuerySelect::having()
Returns SQL that set having by a given expression.
public ezcQuery ezcQuerySelect::innerJoin()
Returns the SQL for an inner join or prepares $fromString for an inner join.
public ezcQuery ezcQuerySelect::leftJoin()
Returns the SQL for a left join or prepares $fromString for a left join.
public ezcQuerySelect ezcQuerySelect::limit()
Returns SQL that limits the result set.
public ezcQuery ezcQuerySelect::orderBy()
Returns SQL that orders the result set by a given column.
public void ezcQuerySelect::reset()
Resets the query object for reuse.
public ezcQuery ezcQuerySelect::rightJoin()
Returns the SQL for a right join or prepares $fromString for a right join.
public ezcQuery ezcQuerySelect::select()
Opens the query and selects which columns you want to return with the query.
public ezcQuery ezcQuerySelect::selectDistinct()
Opens the query and uses a distinct select on the columns you want to return with the query.
public ezcQuerySelect ezcQuerySelect::where()
Adds a where clause with logical expressions to the query.
From ezcQuery
public ezcQuery ezcQuery::__construct()
Constructs a new ezcQuery that works on the database $db and with the aliases $aliases.
public static array ezcQuery::arrayFlatten()
Returns all the elements in $array as one large single dimensional array.
public string ezcQuery::bindParam()
Binds the parameter $param to the specified variable name $placeHolder..
public string ezcQuery::bindValue()
Binds the value $value to the specified variable name $placeHolder.
public void ezcQuery::doBind()
Performs binding of variables bound with bindValue and bindParam on the statement $stmt.
protected string ezcQuery::getIdentifier()
Returns the correct identifier for the alias $alias.
protected array(string) ezcQuery::getIdentifiers()
Returns the correct identifiers for the aliases found in $aliases.
public abstract string ezcQuery::getQuery()
Returns the query string for this query object.
public bool ezcQuery::hasAliases()
Returns true if this object has aliases.
public PDOStatement ezcQuery::prepare()
Returns a prepared statement from this query which can be used for execution.
protected void ezcQuery::resetBinds()
Resets the bound values and parameters to empty.
public void ezcQuery::setAliases()
Sets the aliases $aliases for this object.
public ezcQuerySubSelect ezcQuery::subSelect()
Returns the ezcQuerySubSelect query object.
public string ezcQuery::__toString()
Return SQL string for query.

Methods

__construct

ezcQuerySelectSqlite __construct( $db )

Constructs a new ezcQuerySelectSqlite object.

Parameters:
Name Type Description
$db PDO
Redefinition of:
Method Description
ezcQuerySelect::__construct() Constructs a new ezcQuery object.

from

a from( string|array(string) $... )

Select which tables you want to select from.

from() accepts an arbitrary number of parameters. Each parameter must contain either the name of a table or an array containing the names of tables.. from() could be invoked several times. All provided arguments added to the end of $fromString.

Additional actions performed to emulate right joins in SQLite.

Example:

  1.  // the following code will produce the SQL
  2.  // SELECT id FROM t2 LEFT JOIN t1 ON t1.id = t2.id
  3.  $q->select( 'id' )->from( $q->rightJoin( 't1', 't2', 't1.id', 't2.id' ) );
  4.  
  5.  // the following code will produce the same SQL
  6.  // SELECT id FROM t2 LEFT JOIN t1 ON t1.id = t2.id
  7.  $q->select( 'id' )->from( 't1' )->rightJoin( 't2', 't1.id', 't2.id' );
Parameters:
Name Type Description
$... string|array(string) Either a string with a table name or an array of table names.
Exceptions:
Type Description
ezcQueryVariableParameterException if called with no parameters.
Redefinition of:
Method Description
ezcQuerySelect::from() Select which tables you want to select from.

reset

void reset( )

Resets the query object for reuse.

Redefinition of:
Method Description
ezcQuerySelect::reset() Resets the query object for reuse.

rightJoin

ezcQuery rightJoin( string $table2,... )

Returns the SQL for a right join or prepares $fromString for a right join.

This method could be used in two forms:

rightJoin( 't2', $joinCondition )

Takes 2 string arguments and returns ezcQuery.

The first parameter is the name of the table to join with. The table to which is joined should have been previously set with the from() method.

The second parameter should be a string containing a join condition that is returned by an ezcQueryExpression.

Example:

  1.  // the following code will produce the SQL
  2.  // SELECT id FROM t1 LEFT JOIN t2 ON t1.id = t2.id
  3.  $q->select( 'id' )->from( 't1' )->rightJoin( 't2', $q->expr->eq('t1.id', 't2.id' ) );

rightJoin( 't2', 't1.id', 't2.id' )

Takes 3 string arguments and returns ezcQuery. This is a simplified form of the 2 parameter version. rightJoin( 't2', 't1.id', 't2.id' ) is equal to rightJoin( 't2', $this->expr->eq('t1.id', 't2.id' ) );

The first parameter is the name of the table to join with. The table to which is joined should have been previously set with the from() method.

The second parameter is the name of the column on the table set previously with the from() method and the third parameter the name of the column to join with on the table that was specified in the first parameter.

Example:

  1.  // the following code will produce the SQL
  2.  // SELECT id FROM t1 LEFT JOIN t2 ON t1.id = t2.id
  3.  $q->select( 'id' )->from( 't1' )->rightJoin( 't2', 't1.id', 't2.id' );
Parameters:
Name Type Description
$table2,... string The table to join with, followed by either the two join columns, or a join condition.
Exceptions:
Type Description
ezcQueryInvalidException if called with inconsistent parameters or if invoked without preceding call to from().
Redefinition of:
Method Description
ezcQuerySelect::rightJoin() Returns the SQL for a right join or prepares $fromString for a right join.
Documentation generated by phpDocumentor 1.4.3