Path

ez components / documentation / api reference / 2009.2.1 / database


eZ Components 2009.2.1

Database: ezcQuerySelectMssql

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

Class: ezcQuerySelectMssql

SQL Server specific implementation of ezcQuery. [source]
This class reimplements the LIMIT method in which the SQL Server differs from the standard implementation in ezcQuery.

Parents

ezcQuery
   |
   --ezcQuerySelect
      |
      --ezcQuerySelectMssql

Inherited Constants

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

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 string getQuery( )
Transforms the query from the parent to provide LIMIT functionality.
public void limit( $limit, [$offset = 0] )
Returns SQL that limits the result set.
public ezcQuery orderBy( $column, [$type = self::ASC] )
Saves the ordered columns in an internal array so we can invert that order if we need to in the limit() workaround
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
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

getQuery

string getQuery( )
Transforms the query from the parent to provide LIMIT functionality.
Note: doesn't work exactly like the MySQL equivalent; it will always return $limit rows even if $offset + $limit exceeds the total number of rows.

Throws

ClassDescription
ezcQueryInvalidException if offset is used and orderBy is not.

Redefinition of

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

limit

void limit( int $limit, [int $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.

Parameters

Name Type Description
$limit int integer expression
$offset int integer expression

Redefinition of

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

orderBy

ezcQuery orderBy( string $column, [string $type = self::ASC] )
Saves the ordered columns in an internal array so we can invert that order if we need to in the limit() workaround

Parameters

Name Type Description
$column string a column name in the result set
$type string if the column should be sorted ascending or descending. you can specify this using ezcQuerySelect::ASC or ezcQuerySelect::DESC

Redefinition of

Method Description
ezcQuerySelect::orderBy() Returns SQL that orders the result set by a given column.

reset

void reset( )
Resets the query object for reuse.

Redefinition of

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

Last updated: Tue, 23 Mar 2010