Class TSqlCriteria

Description

Search criteria for TDbDataGateway.

Criteria object for data gateway finder methods. Usage:

  1.  $criteria new TSqlCriteria();
  2.  $criteria->Parameters[':name''admin';
  3.  $criteria->Parameters[':pass''prado';
  4.  $criteria->OrdersBy['level''desc';
  5.  $criteria->OrdersBy['name''asc';
  6.  $criteria->Limit 10;
  7.  $criteria->Offset 20;

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

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 ()
int getLimit ()
int getOffset ()
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 '*'

  • since: 3.1.7
  • access: public
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
    1.      array('col1''col2''col2')
    2.      // SELECT `col1`, `col2`, `col3` FROM...
  • Column aliasing
    1.  array('mycol1' => 'col1''mycol2' => 'COUNT(*)')
    2.  // SELECT `col1` AS mycol1, COUNT(*) AS mycol2 FROM...
  • NULL and scalar values (strings will be quoted depending on database)
    1.  array('col1' => 'my custom string''col2' => 1.0'col3' => 'NULL')
    2.  // 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
    1.  array('col1' => 'NULL''*')
    2.  // SELECT `col1`, `col2`, `col3`, NULL AS `col1` FROM...

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::__call()
TComponent::__get()
TComponent::__set()
TComponent::__sleep()
TComponent::__wakeup()

Documentation generated on Mon, 25 Jun 2012 14:39:13 +0200 by phpDocumentor 1.4.3