Path

ez components / documentation / api reference / 1.1.1 / database


eZ Components 1.1.1

Database: ezcQuerySelectSqlite

[ Tutorial ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Class: ezcQuerySelectSqlite

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

Parents

ezcQuery
   |
   --ezcQuerySelect
      |
      --ezcQuerySelectSqlite

Inherited Constants

From ezcQuerySelect:
ezcQuerySelect::ASC    Sort the result ascendingly.
ezcQuerySelect::DESC    Sort the result descendingly.

Member Variables

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

Inherited Member Variables

From ezcQuerySelect:
protected  ezcQuerySelect::$fromString
protected  ezcQuerySelect::$groupString
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( 0 )
Select which tables you want to select from.
public void reset( )
Resets the query object for reuse.
public string rightJoin( $table1, $table2, $column1, $column2, $condition )
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
public a 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 string ezcQuerySelect::innerJoin()
Returns the SQL for a inner join or prepares $fromString for a inner join.
public string ezcQuerySelect::leftJoin()
Returns the SQL for a left join or prepares $fromString for a left join.
public string 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 string 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 ezcQuerySubSelect ezcQuerySelect::subSelect()
Returns the ezcQuerySubSelect query object.
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.

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) 0 )
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
0 string|array(string) Either a string with a table name or an array of table names.

Throws

ClassDescription
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

string rightJoin( string $table1, string $table2, string $column1, string $column2, string $condition )
Returns the SQL for a right join or prepares $fromString for a right join.
SQLite doesn't support a RIGHT JOIN directly, so it's rewrited to a LEFT JOIN of tables in reverse order.
This method could be used in three forms:
  • rightJoin( 't1', 't2', 't1.id', 't2.id' ) takes 4 string arguments and return SQL string

Parameters

Name Type Description
$table1 string the name of the table to join with
$table2 string the name of the table to join. The name of table to join with should be set in previous call to from().
$column1 string the column to join with
$column2 string the column to join on
$condition string the string with join condition returned by ezcQueryExpression.

Redefinition of

Method Description
ezcQuerySelect::rightJoin() Returns the SQL for a right join or prepares $fromString for a right join.

Last updated: Thu, 01 Nov 2007