IDBQuery Interface Reference
[Interfaces]
Represents a DB query. More...
Public Member Functions |
|
| add_field ($field) | |
| Add a field. |
|
| get_fields () | |
| Return fields. |
|
| get_table () | |
| Returns table. |
|
| set_fields ($arr_fields) | |
| Set the fields this query affects. |
|
Public Attributes |
|
| const | CLEAR = null |
| Used for clearing fields. |
|
| const | NORMAL = 0 |
| Default policy. |
|
Detailed Description
Represents a DB query.
Definition at line 12 of file idbquery.cls.php.
Member Function Documentation
| IDBQuery::add_field | ( | $ | field | ) |
| IDBQuery::get_fields | ( | ) |
| IDBQuery::set_fields | ( | $ | arr_fields | ) |
Set the fields this query affects.
Dependent on the query time, the array passed can be of different forms
UPDATE and INSERT: Associative array with field name as key and field value as value
$query = new DBQuery($some_table); $query->set_fields(array('name' => 'Johnny')); $query->add_where('id', '=', 3); $sql = $query->build_update_sql(); // returns UPDATE some_table SET name = 'Johnny' WHERE id = 3
SELECT: Either array of field names or associative array with field name as key and field alias as value. Both can be combined.
$query = new DBQuery($some_table); $query->set_fields(array('count(name)' => 'c', 'phone')); $sql = $query->build_select_sql(); // returns SELECT count(name) AS c, phone FROM some_table
If invoked with DBQuery::CLEAR, the fields will get cleared
- Parameters:
-
array $arr_fields
- Returns:
- void
Implemented in DBQuery.
Member Data Documentation
| const IDBQuery::CLEAR = null |
Used for clearing fields.
Definition at line 16 of file idbquery.cls.php.
| const IDBQuery::NORMAL = 0 |
Default policy.
Definition at line 20 of file idbquery.cls.php.
The documentation for this interface was generated from the following file:
- gyro/core/lib/interfaces/idbquery.cls.php
