Class xPDOCriteria
Class Overview
|
Encapsulates a PDOStatement and a set of bindings. Located in /xpdo.class.php [line 1349] |
[ Top ]
Direct descendents
Property Summary
Method Summary
| xPDOCriteria | __construct() | Creates a new xPDOCriteria instance. |
| xPDOCriteria | xPDOCriteria() | |
| void | bind() | Binds an array of key/value pairs to the xPDOCriteria prepared statement. |
| boolean | equals() | Compares to see if two xPDOCriteria instances are the same. |
| void | prepare() |
[ Top ]
Properties
Methods
Constructor __construct [line 1379]
|
Creates a new xPDOCriteria instance.
The constructor optionally prepares provided SQL and/or parameter bindings. Setting the bindings via the constructor or with the xPDOCriteria::bind() function allows you to make use of the data object caching layer.
Parameters:| string | $sql: | The SQL statement. |
| array | $bindings: | Bindings to bind to the criteria. |
| boolean|integer | $cacheFlag: | Indicates if the result set from the criteria is to be cached (true|false) and how long it will live in cache in seconds. |
| &$xpdo: |
Information Tags:
| Todo: | Refactor this so you can get an xPDOCriteria instance without calling the prepare and bind methods explicitly. In this way, the criteria can be constructed without the database connection required. Without this, every request will require a database connection before even looking at the object/result set cache. |
Redefined in descendants as:
[ Top ]
Constructor xPDOCriteria [line 1355]
|
| &$xpdo: | ||
| $sql: | ||
| $bindings: | ||
| $cacheFlag: |
[ Top ]
bind [line 1410]
|
Binds an array of key/value pairs to the xPDOCriteria prepared statement.
Use this method to bind parameters in a way that makes it possible to cache results of previous executions of the criteria or compare the criteria to other individual or collections of criteria.
Parameters:| array | $bindings: | Bindings to merge with any existing bindings defined for this xPDOCriteria instance. Bindings can be simple associative array of key-value pairs or the value for each key can contain elements titled value, type, and length corresponding to the appropriate parameters in the PDOStatement::bindValue() and PDOStatement::bindParam() functions. |
| boolean | $byValue: | Determines if the $bindings are to be bound as parameters (by variable reference, the default behavior) or by direct value (if true). |
| boolean|integer | $cacheFlag: | The cacheFlag indicates the cache state of the xPDOCriteria object and can be absolutely off (false), absolutely |
[ Top ]
equals [line 1444]
|
Compares to see if two xPDOCriteria instances are the same.
Parameters:| object | $obj: | A xPDOCriteria object to compare to this one. |
API Tags:
| Return: | true if they are both equal is SQL and bindings, otherwise false. |
[ Top ]