메소드 | 설명 | |
---|---|---|
__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 ) |
메소드 | 설명 | |
---|---|---|
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 | ||
리턴 | string | SQL with limit and offset. |
public applyOrdering ( $sql, $ordering ) : string | ||
리턴 | string | modified SQL applied with ORDER BY. |
public bindColumnValues ( $command, $values ) |
public createCommand ( $sql ) : TDbCommand | ||
리턴 | TDbCommand | corresponding database command. |
public createCountCommand ( $where = '1=1', $parameters = [], $ordering = [], $limit, $offset ) : TDbCommand | ||
리턴 | TDbCommand | count command. |
public createDeleteCommand ( $where, $parameters = [] ) : TDbCommand | ||
리턴 | TDbCommand | delete command. |
public createFindCommand ( $where = '1=1', $parameters = [], $ordering = [], $limit, $offset, $select = '*' ) : TDbCommand | ||
리턴 | TDbCommand | query command. |
public createInsertCommand ( $data ) : TDbCommand | ||
리턴 | TDbCommand | insert command |
public createUpdateCommand ( $data, $where, $parameters = [] ) : TDbCommand | ||
리턴 | TDbCommand | update command. |
protected getColumnBindings ( $values, $position = false ) : string | ||
리턴 | string | update column names with corresponding binding substrings. |
public getDbConnection ( ) : TDbConnection | ||
리턴 | TDbConnection | database connection. |
protected getInsertFieldBindings ( $values ) : array | ||
리턴 | array | tuple ($fields, $bindings) |
public getLastInsertID ( ) : mixed | ||
리턴 | mixed | last insert id, null if none is found. |
public static getPdoType ( $value ) : integer | ||
리턴 | integer | PDO parameter types. |
protected getSearchCondition ( $column, $words ) : string | ||
리턴 | string | search condition for all words in one column. |
public getSearchExpression ( $fields, $keywords ) : string | ||
리턴 | 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 | ||
리턴 | array | of generated fields - use implode(', ', $selectfieldlist) to collapse field list for usage |
protected hasIntegerKey ( $array ) : boolean | ||
리턴 | boolean | true if any array key is an integer. |