YANA 4 PHP Framework
Docs For Class DbQuery
Database query builder
This class is a query builder that can be used to build SQL statements.
Note: this class does NOT untaint input data for you. It also does NOT automatically resolve foreign keys.
This class is still experimental. Names and functions might get added, removed or changed without further notice. Use at your own risk!
Located in /includes/class_dbquery.php
Object | --DbQuery
Name | Type | Description |
---|---|---|
$database | object |
This creates and initializes a new instance of this class.
Returns the lower-cased name of the currently selected column.
If none has been selected, '*' is returned.
Name | Type | Description |
---|---|---|
$table | string |
If $table is not provided, all tables are returned.
Returns the lower-cased column name, or bool(false) if none has been set yet.
Returns the lower-cased name of the currently selected column, or bool(false) if none has been selected yet.
Returns the lower-cased name of the currently selected table, or bool(false) if none has been selected yet.
Returns currently selected constant.
If none are available, NULL (not bool(false)!) is returned.
Returns the current where clause.
Returns bool(true) if sorted descending and bool(false) otherwise.
Name | Type | Description |
---|---|---|
$column | string |
Returns bool(true) on success and bool(false) on error.
Name | Type | Description |
---|---|---|
$table | string | name of another table to join table1 with (when omitted will remove all previously set joins from table1) |
$key1 | string | name of the foreign key in current table (when omitted the API will look up the key in the structure file) |
$key2 | string | name of the key in foreign table that is referenced (may be omitted if it is the primary key) |
This will join the currently selected table with another.
Name | Type | Description |
---|---|---|
$key | string |
Returns bool(true) on success and bool(false) on error.
Name | Type | Description |
---|---|---|
$orderBy | string|array | column name / list of column names |
$desc | bool | sort descending (true=yes, false=no) |
Returns bool(true) on success and bool(false) on error.
Name | Type | Description |
---|---|---|
$row | scalar |
Returns bool(true) on success and bool(false) on error.
Note: does not check if row exists.
Currently you may only request 1 row or all. To search for all rows, use the wildcard '*'.
Name | Type | Description |
---|---|---|
$table | string |
Returns bool(true) on success and bool(false) on error.
Name | Type | Description |
---|---|---|
$type | int |
Returns bool(true) on success and bool(false) on error.
Name | Type | Description |
---|---|---|
&$values |
Returns bool(true) on success and bool(false) on error.
Name | Type | Description |
---|---|---|
$where | string|array |
The syntax is as follows: column1=value1,column2=value2,...,columnN=valueN
The alternative is as follows: array(array(0=>column1,1=>value1,2=>operator1),...) Where "operator" can be one of the following: '=', 'LIKE', '<', '>', '!=', '<=', '>='
To unset the where clause, call this function without providing a parameter.
Returns bool(true) on success and bool(false) on error.
Redefinition of: Object::toString()
Inherited From Object
Documentation generated on Sun, 11 Mar 2007 15:02:26 +0100 by phpDocumentor 1.3.1