Database: ezcQuerySelectOracle
[ ]
[ Oracle setup ]
[ ]
[ ]
[ ]
[ ]
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:
Inherited Member Variables
From
ezcQuerySelect:
From
ezcQuery:
Method Summary
|
public ezcQuerySelectOracle |
__construct(
$db )
Constructs a new ezcQueryOracle object working on the database $db. |
|
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 ezcQuerySelect |
limit(
$limit, [$offset = 0] )
Returns SQL that limits the result set. |
|
public PDOStatement |
prepare(
)
Handles preparing query. |
|
public void |
reset(
)
Resets the query object for reuse. |
Inherited Methods
From
ezcQuerySelect :
From
ezcQuery :
Methods
__construct
ezcQuerySelectOracle __construct(
$db )
Constructs a new ezcQueryOracle object working on the database $db.
Parameters
| Name |
Type |
Description |
$db |
PDO |
|
Redefinition of
alias
string alias(
string
$name, string
$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 |
string |
Old name |
$alias |
string |
Alias |
Redefinition of
getDummyTableName
string getDummyTableName(
)
Returns dummy table name 'dual'.
Redefinition of
getQuery
void getQuery(
)
Transforms the query from the parent to provide LIMIT functionality.
Redefinition of
limit
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.
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 10, 5
3. The corresponding Oracle query:
4. SELECT * FROM (SELECT a.*, ROWNUM rn FROM (SELECT * FROM table) a WHERE rownum <= 15) WHERE 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.
Parameters
| Name |
Type |
Description |
$limit |
string |
integer expression |
$offset |
string |
integer expression |
Redefinition of
prepare
PDOStatement prepare(
)
Handles preparing query.
Overrides ezcQuery->prepare()
Adds "FROM dual" to the select if no FROM clause specified i.e. fixes queries like "SELECT 1+1" to work in Oracle.
Redefinition of
| Method |
Description |
ezcQuery::prepare() |
Returns a prepared statement from this query which can be used for execution. |
reset
void reset(
)
Resets the query object for reuse.
Redefinition of
Last updated: Tue, 02 Dec 2008