Path

ez components / documentation / api reference / 1.0.1 / database


eZ Components 1.0.1

Database: ezcQuerySelectOracle

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

Class: ezcQuerySelectOracle

Oracle specific implementation of ezcQuery. [source]
This class reimplements methods where Oracle differs from the standard implementation in ezcQuery.Most notably LIMIT which is not supported directly in oracle.

Parents

ezcQuery
   |
   --ezcQuerySelect
      |
      --ezcQuerySelectOracle

Inherited Constants

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

Inherited Member Variables

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

Method Summary

public ezcQuerySelectOracle __construct( $db )
Constructs a new ezcQueryOracle object.
public string alias( $name, $alias )
Returns SQL to create an alias.
public static string getDummyTableName( )
Returns dummy table name 'dual'.
public void getQuery( )
Transforms the query from the parent to provide LIMIT functionality.
public string limit( $limit, [$offset = 0] )
Returns SQL that limits the result set.
public void reset( )
Resets the query object for reuse.

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.
public ezcQuery ezcQuerySelect::groupBy()
Returns SQL that groups the result set by a given column.
public string ezcQuerySelect::innerJoin()
Returns the SQL for an inner join.
public string ezcQuerySelect::leftJoin()
Returns the SQL 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.
public ezcQuery ezcQuerySelect::select()
Opens the query and selects which 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 &mixed ezcQuery::bindParam()
Binds the parameter $param to the specified variable name $placeHolder..
public &mixed 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.
public void ezcQuery::setAliases()
Sets the aliases $aliases for this object.

Methods

__construct

ezcQuerySelectOracle __construct( $db )
Constructs a new ezcQueryOracle object.

Parameters

Name Type Description
$db PDO  

Redefinition of

Method Description
ezcQuerySelect::__construct() Constructs a new ezcQuery object.

alias

string alias( $name, $alias )
Returns SQL to create an alias.
This method can be used to create an alias for either a table or a column. Example:
1.  // this will make the table users have the alias employees
2.  // and the column user_id the alias employee_id
3.   $q->select$q->aliAs'user_id''employee_id' )
4.    ->from$q->aliAs'users''employees' ) );

Parameters

Name Type Description
$name  
$alias  

Redefinition of

Method Description
ezcQuerySelect::alias() Returns SQL to create an alias

getDummyTableName

string getDummyTableName( )
Returns dummy table name 'dual'.

Redefinition of

Method Description
ezcQuerySelect::getDummyTableName() Returns dummy table name.

getQuery

void getQuery( )
Transforms the query from the parent to provide LIMIT functionality.

Redefinition of

Method Description
ezcQuerySelect::getQuery() Returns the complete select query.

limit

string limit( mixed $limit, [mixed $offset = 0] )
Returns SQL that limits the result set.
$limit controls the maximum number of rows that will be returned. $offset controls which row that will be the first in the result set from the total amount of matching rows.
Example:
1.  $q->select'*' )->from'table' )
2.                   ->limit10);
Oracle does not support the LIMIT keyword. A complete rewrite of the query is neccessary. Queries will be rewritten like this:
1.  Original query in MySQL syntax:
2.  SELECT FROM table LIMIT 105
3.  The corresponding Oracle query:
4.  SELECT FROM (SELECT a.*ROWNUM rn FROM (SELECT FROM tablea WHERE rownum <= 15WHERE rn >= 6;
Even though the Oracle query is three times as long it performs about the same as mysql on small result sets and a bit better on large result sets.
Note that you will not get a result if you call buildLimit() when using the oracle database.

Redefinition of

Method Description
ezcQuerySelect::limit() Returns SQL that limits the result set.

reset

void reset( )
Resets the query object for reuse.

Redefinition of

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

Last updated: Fri, 02 Nov 2007