POT
POT
POT
Main menu

Download

Forum

SVN

Class: OTS_SQLFilter

Source Location: /classes/OTS_SQLFilter.php

Class OTS_SQLFilter

Class Overview

SQL WHERE clause object.

SQL WHERE clause object. Objects of this class can be used to filter list objects using setFilter() method. To compose more complex WHERE clauses you can append another filter to this one to create sub-condition.

Located in /classes/OTS_SQLFilter.php [line 28]

OTS_Base_DAO
   |
   --OTS_SQLFilter
Author(s):
API Tags:
Property-read:  array $tables: List of tables used by this statement.

Information Tags:
Tutorial:  List objects
Version:  0.0.5
Version:  0.1.3
Since:  0.0.5

Methods

[ Top ]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants

Inherited From OTS_Base_DAO

OTS_Base_DAO::$db

Inherited From OTS_Base_DAO

OTS_Base_DAO::__construct()
Sets database connection handler.
OTS_Base_DAO::__clone()
Creates clone of object.
OTS_Base_DAO::__set_state()
Magic PHP5 method.
OTS_Base_DAO::__sleep()
Magic PHP5 method.
OTS_Base_DAO::__wakeup()
Magic PHP5 method.

[ Top ]
Constant Summary
CRITERIUM_AND   AND sibling.
CRITERIUM_OR   OR sibling.
OPERATOR_EQUAL   Equal operator.
OPERATOR_GREATER   Greater-then operator.
OPERATOR_LIKE   LIKE operator.
OPERATOR_LOWER   Lower-then operator.
OPERATOR_NEQUAL   Not-equal operator.
OPERATOR_NGREATER   Not-greater-then operator.
OPERATOR_NLIKE   Not-LIKE operator.
OPERATOR_NLOWER   Not-lower-then operator.

[ Top ]
Method Summary
void   addFilter()   General-purpose filter.
void   compareField()   Compares field with a literal value.
array   getTables()   Returns list of all tables used by filter.
void   __clone()   Creates clone of object.
mixed   __get()   Magic PHP5 method.
array   __sleep()   Magic PHP5 method.
string   __toString()   Returns string representation of WHERE clause.

[ Top ]
Methods
addFilter  [line 247]

  void addFilter( mixed $left, [mixed $right = null], [int $operator = self::OPERATOR_EQUAL], [int $criterium = self::CRITERIUM_AND]  )

General-purpose filter.

General-purpose filter. Appends new filter in universal way. You can append either literal value comparsion, fields comparsion or another filter object as sub-condition.

To append subset of another filters use addFilter($OTS_SQLFilterObject).

Parameters:
mixed   $left:  Left side (OTS_SQLField class object, OTS_SQLFilter class object, or literal value).
mixed   $right:  Right side (OTS_SQLField class object, or literal value).
int   $operator:  Operator used for comparsion (equal check by default).
int   $criterium:  Criterium merging method (AND by default).

API Tags:
Access:  public

Information Tags:
Version:  0.0.5
Since:  0.0.5

[ Top ]
compareField  [line 261]

  void compareField( string $field, mixed $value, [int $operator = self::OPERATOR_EQUAL], [int $criterium = self::CRITERIUM_AND]  )

Compares field with a literal value.

Compares field with a literal value.

Parameters:
string   $field:  Field name.
mixed   $value:  Literal value.
int   $operator:  Operator used for comparsion (equal by default).
int   $criterium:  Criterium merging method (AND by default).

API Tags:
Access:  public
Example:  filter.php

Information Tags:
Version:  0.0.5
Since:  0.0.5

[ Top ]
getTables  [line 275]

  array getTables( )

Returns list of all tables used by filter.

Returns list of all tables used by filter. This is required for FROM clause.


API Tags:
Return:  List of all tables used by this filter.
Access:  public

Information Tags:
Version:  0.0.5
Since:  0.0.5

[ Top ]
__clone  [line 103]

  void __clone( )

Creates clone of object.

Creates clone of object. This method is empty to override OTS_Base_DAO method.


API Tags:
Access:  public

Information Tags:
Version:  0.1.3
Version:  0.0.5
Since:  0.0.5
Since:  0.1.3

Redefinition of:
OTS_Base_DAO::__clone()
Creates clone of object.

[ Top ]
__get  [line 333]

  mixed __get( string $name  )

Magic PHP5 method.

Magic PHP5 method.

Parameters:
string   $name:  Property name.

API Tags:
Return:  Property value.
Access:  public

Information Tags:
Version:  0.1.0
Version:  0.0.5
Throws:  OutOfBoundsException For non-supported properties.
Since:  0.1.0
Since:  0.0.5

[ Top ]
__sleep  [line 88]

  array __sleep( )

Magic PHP5 method.

Magic PHP5 method. Allows object serialisation.


API Tags:
Return:  List of properties that should be saved.
Access:  public

Information Tags:
Version:  0.0.5
Since:  0.0.5

Redefinition of:
OTS_Base_DAO::__sleep()
Magic PHP5 method.

[ Top ]
__toString  [line 117]

  string __toString( )

Returns string representation of WHERE clause.

Returns string representation of WHERE clause. Returned string can be easily inserted into SQL query.


API Tags:
Return:  String WHERE clause.
Access:  public

Information Tags:
Version:  0.1.0
Version:  0.0.5
Since:  0.0.5

[ Top ]
Constants
CRITERIUM_AND = 1 [line 66]

AND sibling.

AND sibling.

Information Tags:
Version:  0.0.5
Since:  0.0.5

[ Top ]
CRITERIUM_OR = 2 [line 70]

OR sibling.

OR sibling.

Information Tags:
Version:  0.0.5
Since:  0.0.5

[ Top ]
OPERATOR_EQUAL = 1 [line 33]

Equal operator.

Equal operator.

Information Tags:
Version:  0.0.5
Since:  0.0.5

[ Top ]
OPERATOR_GREATER = 3 [line 41]

Greater-then operator.

Greater-then operator.

Information Tags:
Version:  0.0.5
Since:  0.0.5

[ Top ]
OPERATOR_LIKE = 7 [line 57]

LIKE operator.

LIKE operator.

Information Tags:
Version:  0.0.5
Since:  0.0.5

[ Top ]
OPERATOR_LOWER = 2 [line 37]

Lower-then operator.

Lower-then operator.

Information Tags:
Version:  0.0.5
Since:  0.0.5

[ Top ]
OPERATOR_NEQUAL = 4 [line 45]

Not-equal operator.

Not-equal operator.

Information Tags:
Version:  0.0.5
Since:  0.0.5

[ Top ]
OPERATOR_NGREATER = 6 [line 53]

Not-greater-then operator.

Not-greater-then operator.

Information Tags:
Version:  0.0.5
Since:  0.0.5

[ Top ]
OPERATOR_NLIKE = 8 [line 61]

Not-LIKE operator.

Not-LIKE operator.

Information Tags:
Version:  0.0.5
Since:  0.0.5

[ Top ]
OPERATOR_NLOWER = 5 [line 49]

Not-lower-then operator.

Not-lower-then operator.

Information Tags:
Version:  0.0.5
Since:  0.0.5

[ Top ]