메소드 | 설명 | |
---|---|---|
all ( string $fields = self::ALL_COLUMNS_SELECTION, string $condition = '', integer $start, integer | null $limit = null, string | null $tableName = null ) : array | Returns table rows as array | |
assoc ( string $fields = self::ALL_COLUMNS_SELECTION, string $condition = '', string | null $tableName = null, integer $start, integer | null $limit = null ) : array | Returns associative array of rows, first column of the query is used as a key | |
bind ( string &$sql, array $values ) : void | Binds queries to make SQL more readable | |
cascadeDelete ( string | array $tbl, string $where = '' ) : boolean | integer | Accepts array of table names and deletes records in them | |
convertIds ( array | string | integer $ids, string $columnName = 'id', boolean $equal = true ) : boolean | string | Converts various condition params to a mysql formatted WHERE case string | |
delete ( string $condition, string | null $tableName = null, array $values = [] ) : integer | Deletes records in a table and returns number of affected rows by the query | |
describe ( null $tableName = null, boolean $addPrefix = true ) : array | Provides information about the columns in a table | |
exists ( string $where, array $values = [], null $tableName = null ) : boolean | Returns true if at least 1 record exists | |
foundRows ( ) : integer | Returns number of found rows of the previous query with SQL_CALC_FOUND_ROWS Note: this SQL function is MySQL specific | |
getAffected ( ) : integer | Returns a number of affected rows in a previous INSERT operation | |
getAll ( string $sql, integer $start, integer $limit ) : array | Returns table rows as array | |
getAssoc ( string $sql, boolean $singleRow = false ) : array | Returns associative array of rows, first column of the query is used as a key | |
getCount ( ) : integer | Returns number of queries | |
getEnumValues ( string $table, string $field ) : array | boolean | Returns all ENUM and SET values for selected table and field | |
getErrorNumber ( ) : integer | Returns the numerical value of the error message from previous database operation | |
getInsertId ( ) : integer | Returns the ID generated in the last query | |
getKeyValue ( string $sql ) : array | Returns key => value pair array of rows | |
getLastQuery ( ) : string | Returns last executed query | |
getMaxOrder ( string $table = null, array $condition = null ) : boolean | mixed | Returns max value for order column | |
getNumRows ( resource $resource ) : integer | Returns a number of rows in a result | |
getOne ( string $sql ) : mixed | Returns field value of a row | |
getPrefix ( ) : string | Returns table prefix value | |
getQueriesList ( ) : array | Returns list of executed queries | |
getRow ( string $sql ) : array | boolean | Returns one table row as array | |
insert ( array $values, array | null $rawValues = null, string | null $tableName = null ) : integer | Inserts a new record in a table and returns id of the inserted row | |
keyvalue ( string $fields = self::ALL_COLUMNS_SELECTION, string $condition = null, string | null $tableName = null, integer $start, integer | null $limit = null ) : array | Returns key => value pair array of rows | |
one ( string $field, string $condition = '', string | null $tableName = null, integer $start ) : boolean | mixed | Returns field value of a row | |
one_bind ( string $field, string $condition, array $values, null $tableName = null, integer $start ) : array | Returns one field value on binding completion | |
onefield ( string $field = self::ID_COLUMN_SELECTION, string $condition = null, integer $start, integer | null $limit = null, string | null $tableName = null ) : array | Returns table column values as an array | |
orderByRand ( integer | string $max, string $id_name = '`id`', integer $pieces = 12, integer $delimiter = 100 ) : mixed | Generates a faster way to select random records | |
printf ( string $pattern, array $replacements ) : string | Returns a formatted string according to replacements Does NOT sanitize any input (!) | |
query ( string $sql ) : resource | Executes database query | |
replace ( array $values, array | null $rawValues = null, string | null $tableName = null ) : integer | Replaces a record in a table | |
resetTable ( ) : void | Resets table name to the previous state | |
row ( string $fields = self::ALL_COLUMNS_SELECTION, string $condition = '', string | null $tableName = null, integer $start ) : array | Returns one table row as array | |
row_bind ( string $fields, string $condition, array $values, null $tableName = null, integer $start ) : array | Returns single row array on binding completion | |
setTable ( string $tableName, boolean $addPrefix = true ) : void | Sets table to work with (in most cases resetTable should be called after calling this method) | |
setTimezoneOffset ( $offset ) | ||
truncate ( null | string $table = null ) : boolean | Truncates table | |
update ( array $values, string $condition = null, array | null $rawValues = null, string | null $tableName = null ) : boolean | integer | Updates a record in a table and returns a number of affected rows |
public all ( string $fields = self::ALL_COLUMNS_SELECTION, string $condition = '', integer $start, integer | null $limit = null, string | null $tableName = null ) : array | ||
$fields | string | fields to be selected |
$condition | string | condition for the selection |
$start | integer | start position |
$limit | integer | null | number of records to be returned |
$tableName | string | null | table name to select records from, null uses current set table |
리턴 | array |
public assoc ( string $fields = self::ALL_COLUMNS_SELECTION, string $condition = '', string | null $tableName = null, integer $start, integer | null $limit = null ) : array | ||
$fields | string | fields to be selected |
$condition | string | condition for the selection |
$tableName | string | null | table name to select records from, null uses current set table |
$start | integer | start position |
$limit | integer | null | number of records to be returned |
리턴 | array |
public delete ( string $condition, string | null $tableName = null, array $values = [] ) : integer | ||
$condition | string | condition to perform deletion |
$tableName | string | null | table name where to perform deletion, null - deletes currently set table |
$values | array | real values key=>value array to be replaced in condition |
리턴 | integer |
public getAffected ( ) : integer | ||
리턴 | integer |
public getErrorNumber ( ) : integer | ||
리턴 | integer |
public getInsertId ( ) : integer | ||
리턴 | integer |
public getKeyValue ( string $sql ) : array | ||
$sql | string | sql query |
리턴 | array |
public getNumRows ( resource $resource ) : integer | ||
$resource | resource | query resource |
리턴 | integer |
public insert ( array $values, array | null $rawValues = null, string | null $tableName = null ) : integer | ||
$values | array | key=>value array for the record |
$rawValues | array | null | key=>value array for the record without sanitizing, commonly used for date insert |
$tableName | string | null | table name to perform insertion, null uses current set table |
리턴 | integer |
public keyvalue ( string $fields = self::ALL_COLUMNS_SELECTION, string $condition = null, string | null $tableName = null, integer $start, integer | null $limit = null ) : array | ||
$fields | string | fields to be selected |
$condition | string | condition for the selection |
$tableName | string | null | table name to select records from, null uses current set table |
$start | integer | start position |
$limit | integer | null | number of records to be returned |
리턴 | array |
public one ( string $field, string $condition = '', string | null $tableName = null, integer $start ) : boolean | mixed | ||
$field | string | field to be selected |
$condition | string | condition for the selection |
$tableName | string | null | table name to select records from, null uses current set table |
$start | integer | starting position |
리턴 | boolean | mixed |
public one_bind ( string $field, string $condition, array $values, null $tableName = null, integer $start ) : array | ||
$field | string | field name value to be returned |
$condition | string | condition to be used for the selection |
$values | array | values key=>value array to be replaced in sql query |
$tableName | null | table name to select a record from, null uses current set table |
$start | integer | start position |
리턴 | array |
public onefield ( string $field = self::ID_COLUMN_SELECTION, string $condition = null, integer $start, integer | null $limit = null, string | null $tableName = null ) : array | ||
$field | string | field name column to be selected |
$condition | string | condition for the selection |
$start | integer | start position |
$limit | integer | null | number of records to be returned |
$tableName | string | null | table name to select records from, null uses current set table |
리턴 | array |
public replace ( array $values, array | null $rawValues = null, string | null $tableName = null ) : integer | ||
$values | array | key=>value array for the record |
$rawValues | array | null | key=>value array for the record without sanitizing, commonly used for date insert |
$tableName | string | null | table name to perform insertion, null uses current set table |
리턴 | integer |
public row ( string $fields = self::ALL_COLUMNS_SELECTION, string $condition = '', string | null $tableName = null, integer $start ) : array | ||
$fields | string | fields to be selected |
$condition | string | condition for the selection |
$tableName | string | null | table name to select records from, null uses current set table |
$start | integer | start position |
리턴 | array |
public row_bind ( string $fields, string $condition, array $values, null $tableName = null, integer $start ) : array | ||
$fields | string | fields to be returned |
$condition | string | condition to be used for the selection |
$values | array | values key=>value array to be replaced in sql query |
$tableName | null | table name to select a record from, null uses current set table |
$start | integer | start position |
리턴 | array |
public update ( array $values, string $condition = null, array | null $rawValues = null, string | null $tableName = null ) : boolean | integer | ||
$values | array | fields key=>value array to be updated |
$condition | string | condition used for the update query, if empty tries to update using id field from $fields array |
$rawValues | array | null | key=>value array for the record without sanitizing, commonly used for date insert |
$tableName | string | null | table name to perform update, null uses current set table |
리턴 | boolean | integer |