Méthode | Description | |
---|---|---|
__construct ( $connection = null, $tableInfo = null ) | ||
applyCriterias ( $sql, $parameters = [], $ordering = [], $limit, $offset ) | ||
applyLimitOffset ( $sql, $limit, $offset ) : string | Alters the sql to apply $limit and $offset. Default implementation is applicable for PostgreSQL, MySQL and SQLite. | |
applyOrdering ( $sql, $ordering ) : string | ||
bindArrayValues ( $command, $values ) | ||
bindColumnValues ( $command, $values ) | Bind the name-value pairs of $values where the array keys correspond to column names. | |
createCommand ( $sql ) : TDbCommand | ||
createCountCommand ( $where = '1=1', $parameters = [], $ordering = [], $limit, $offset ) : TDbCommand | Creates a count(*) command for the table described in {@link setTableInfo TableInfo}. | |
createDeleteCommand ( $where, $parameters = [] ) : TDbCommand | Creates a delete command for the table described in {@link setTableInfo TableInfo}. | |
createFindCommand ( $where = '1=1', $parameters = [], $ordering = [], $limit, $offset, $select = '*' ) : TDbCommand | Appends the $where condition to the string "SELECT * FROM tableName WHERE ". | |
createInsertCommand ( $data ) : TDbCommand | Creates an insert command for the table described in {@link setTableInfo TableInfo} for the given data. | |
createUpdateCommand ( $data, $where, $parameters = [] ) : TDbCommand | Creates an update command for the table described in {@link setTableInfo TableInfo} for the given data. | |
getDbConnection ( ) : TDbConnection | ||
getLastInsertID ( ) : mixed | Iterate through all the columns and returns the last insert id of the first column that has a sequence or serial. | |
getPdoType ( $value ) : integer | ||
getSearchExpression ( $fields, $keywords ) : string | Computes the SQL condition for search a set of column using regular expression (or LIKE, depending on database implementation) to match a string of keywords (default matches all keywords). | |
getSelectFieldList ( $data = '*' ) : array | Different behavior depends on type of passed data string usage without modification | |
getTableInfo ( ) | ||
setDbConnection ( $value ) | ||
setTableInfo ( $value ) |
Méthode | Description | |
---|---|---|
getColumnBindings ( $values, $position = false ) : string | Create a name-value or position-value if $position=true binding strings. | |
getInsertFieldBindings ( $values ) : array | Returns a list of insert field name and a list of binding names. | |
getSearchCondition ( $column, $words ) : string | ||
hasIntegerKey ( $array ) : boolean |
public applyCriterias ( $sql, $parameters = [], $ordering = [], $limit, $offset ) |
public applyLimitOffset ( $sql, $limit, $offset ) : string | ||
Résultat | string | SQL with limit and offset. |
public applyOrdering ( $sql, $ordering ) : string | ||
Résultat | string | modified SQL applied with ORDER BY. |
public bindColumnValues ( $command, $values ) |
public createCommand ( $sql ) : TDbCommand | ||
Résultat | TDbCommand | corresponding database command. |
public createCountCommand ( $where = '1=1', $parameters = [], $ordering = [], $limit, $offset ) : TDbCommand | ||
Résultat | TDbCommand | count command. |
public createDeleteCommand ( $where, $parameters = [] ) : TDbCommand | ||
Résultat | TDbCommand | delete command. |
public createFindCommand ( $where = '1=1', $parameters = [], $ordering = [], $limit, $offset, $select = '*' ) : TDbCommand | ||
Résultat | TDbCommand | query command. |
public createInsertCommand ( $data ) : TDbCommand | ||
Résultat | TDbCommand | insert command |
public createUpdateCommand ( $data, $where, $parameters = [] ) : TDbCommand | ||
Résultat | TDbCommand | update command. |
protected getColumnBindings ( $values, $position = false ) : string | ||
Résultat | string | update column names with corresponding binding substrings. |
public getDbConnection ( ) : TDbConnection | ||
Résultat | TDbConnection | database connection. |
protected getInsertFieldBindings ( $values ) : array | ||
Résultat | array | tuple ($fields, $bindings) |
public getLastInsertID ( ) : mixed | ||
Résultat | mixed | last insert id, null if none is found. |
public static getPdoType ( $value ) : integer | ||
Résultat | integer | PDO parameter types. |
protected getSearchCondition ( $column, $words ) : string | ||
Résultat | string | search condition for all words in one column. |
public getSearchExpression ( $fields, $keywords ) : string | ||
Résultat | string | SQL search condition matching on a set of columns. |
array('col1', 'col2', 'col2')
SELECT col1, col2, col3 FROM...
- Column aliasing
array('mycol1' => 'col1', 'mycol2' => 'COUNT(*)')
SELECT col1 AS mycol1, COUNT(*) AS mycol2 FROM...
- NULL and scalar values (strings will be quoted depending on database)
array('col1' => 'my custom string', 'col2' => 1.0, 'col3' => 'NULL')
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
array('col1' => 'NULL', '*')
SELECT col1, col2, col3, NULL AS col1 FROM...
public getSelectFieldList ( $data = '*' ) : array | ||
Résultat | array | of generated fields - use implode(', ', $selectfieldlist) to collapse field list for usage |
protected hasIntegerKey ( $array ) : boolean | ||
Résultat | boolean | true if any array key is an integer. |