## Class TSqlCriteria

Description

Search criteria for TDbDataGateway.

Criteria object for data gateway finder methods. Usage:

     $criteria = new TSqlCriteria();
     $criteria->Parameters[':name'] = 'admin';
     $criteria->Parameters[':pass'] = 'prado';
     $criteria->OrdersBy['level'] = 'desc';
     $criteria->OrdersBy['name'] = 'asc';
     $criteria->Limit = 10;
     $criteria->Offset = 20;

- since: 3.1
- version: $Id: TDbSqlCriteria.php 1835 2007-04-03 01:38:15Z wei $
- author: Wei Zhuo <weizho[at]gmail[dot]com>

Located in /Data/DataGateway/TSqlCriteria.php (line 32)

    TComponent
       |
       --TSqlCriteria

Direct descendents

Class | Description
--- | ---
TActiveRecordCriteria | Search criteria for Active Record.

Method Summary
TSqlCriteria __construct ([string $condition = null], [mixed $parameters = array()])
string getCondition ()
boolean getIsNamedParameters ()
int getLimit ()
int getOffset ()
TAttributeCollection getOrdersBy ()
TAttributeCollection getParameters ()
mixed getSelect ()
void setCondition (string $value)
void setLimit (int $value)
void setOffset (int $value)
void setOrdersBy (mixed $value)
void setParameters (ArrayAccess $value)
void setSelect (mixed $value)
string __toString ()
Methods
Constructor __construct (line 50)

Creates a new criteria with given condition;

- access: public

TSqlCriteria __construct ([string $condition = null], [mixed $parameters = array()])

- string $condition: sql string after the WHERE stanza
- mixed $parameters: named or indexed parameters, accepts as multiple arguments.

getCondition (line 120)

- return: search conditions.
- access: public

string getCondition ()
getIsNamedParameters (line 193)

- return: true if the parameter index are string base, false otherwise.
- access: public

boolean getIsNamedParameters ()
getLimit (line 230)

- return: maximum number of records to return.
- access: public

int getLimit ()
getOffset (line 246)

- return: record offset.
- access: public

int getOffset ()
getOrdersBy (line 202)

- return: ordering clause.
- access: public

TAttributeCollection getOrdersBy ()
getParameters (line 175)

- return: list of named parameters and values.
- access: public

TAttributeCollection getParameters ()
getSelect (line 68)

Gets the field list to be placed after the SELECT in the SQL. Default to '*'

- access: public
- since: 3.1.7

mixed getSelect ()
setCondition (line 129)

Sets the search conditions to be placed after the WHERE clause in the SQL.

- access: public

void setCondition (string $value)

- string $value: search conditions.

setLimit (line 238)

- access: public

void setLimit (int $value)

- int $value: maximum number of records to return.

setOffset (line 254)

- access: public

void setOffset (int $value)

- int $value: record offset.

setOrdersBy (line 210)

- access: public

void setOrdersBy (mixed $value)

- mixed $value: ordering clause.

setParameters (line 183)

- access: public

void setParameters (ArrayAccess $value)

- ArrayAccess $value: named parameters.

setSelect (line 112)

Sets the field list to be placed after the SELECT in the SQL.

Different behavior depends on type of assigned value string usage without modification

null will be expanded to full list of quoted table column names (quoting depends on database)

array

- Column names will be quoted if used as key or value of array

           array('col1', 'col2', 'col2')
           // SELECT `col1`, `col2`, `col3` FROM...

- Column aliasing

       array('mycol1' => 'col1', 'mycol2' => 'COUNT(*)')
       // SELECT `col1` AS mycol1, COUNT(*) AS mycol2 FROM...

- NULL and scalar values (strings will be quoted depending on database)

       array('col1' => 'my custom string', 'col2' => 1.0, 'col3' => 'NULL')
       // SELECT "my custom string" AS `col1`, 1.0 AS `col2`, NULL AS `col3` FROM...

- If the *-wildcard char is used as key or value, add the full list of quoted table column names

       array('col1' => 'NULL', '*')
       // SELECT `col1`, `col2`, `col3`, NULL AS `col1` FROM...

- access: public
- see: TDbCommandBuilder::getSelectFieldList()
- since: 3.1.7

void setSelect (mixed $value)

- mixed $value

__toString (line 262)

- return: string representation of the parameters. Useful for debugging.
- access: public

string __toString ()

#### Inherited Methods

Inherited From TComponent

> TComponent::addParsedObject()
> TComponent::attachEventHandler()
> TComponent::canGetProperty()
> TComponent::canSetProperty()
> TComponent::createdOnTemplate()
> TComponent::detachEventHandler()
> TComponent::evaluateExpression()
> TComponent::evaluateStatements()
> TComponent::getEventHandlers()
> TComponent::getSubProperty()
> TComponent::hasEvent()
> TComponent::hasEventHandler()
> TComponent::hasProperty()
> TComponent::raiseEvent()
> TComponent::setSubProperty()
> TComponent::__get()
> TComponent::__set()

Documentation generated on Mon, 22 Feb 2010 12:18:40 +0000 by phpDocumentor 1.3.0RC4