Database: ezcQuerySelectSqlite
[ ]
[ Oracle setup ]
[ ]
[ ]
[ ]
[ ]
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:
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:
From
ezcQuery:
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 :
From
ezcQuery :
Methods
__construct
ezcQuerySelectSqlite __construct(
$db )
Constructs a new ezcQuerySelectSqlite object.
Parameters
| Name |
Type |
Description |
$db |
PDO |
|
Redefinition of
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. |
Throws
| Class | Description |
ezcQueryVariableParameterException |
if called with no parameters. |
Redefinition of
reset
void reset(
)
Resets the query object for reuse.
Redefinition of
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. |
Throws
| Class | Description |
ezcQueryInvalidException |
if called with inconsistent parameters or if invoked without preceding call to from(). |
Redefinition of
Last updated: Tue, 10 Jun 2008