SCHLIX\cmsSQLTable
Public Methods
public | __construct(string $table_name, \SCHLIX\cmsDatabase $from_database=null, bool $populate_field_names=true) Construct $SystemDB
|
public | __toString() |
public bool | tableExists() Verify if this table exists
|
public | q() |
public array | getFields() Get Table columns as array - this is the raw output from MySQL
|
public array | conformDataValuesToFieldTypes(array $datavalues) The purpose of this function is type safety check. It's important and this is introduced in v2.2.0. Given a key-value array data array, conform the types to table definition for safety check (length). If the field does not exist, then it will be removed from the variable. If it violates the type constrain then it will be modified according to the database type.
|
public array | getParsedFields() Get table fields with field types parsed
|
public bool | fieldExists(string $fieldname) Returns true if fieldname exists
|
public array | getFieldNamesAsArray() Returns this table's column name as array from cache
|
public array | getFieldNamesAsArrayKeys() Returns this table's column name as array - set to key
|
public string | getFieldNamesAsString() Returns the list of field/column names
|
public array | getPrimaryKeysAsArray() Returns the primary key in array form
|
public string | getPrimaryKeyFieldNames() Returns a comma separated field names
|
public array | getPrimaryKeyFieldNamesAsArray() Returns an array containing field names
|
public array | selectAll(string $fields=' *', string $extra_criteria='', string $sortby='', string $sortdirection='ASC', int $start, int $end, bool $add_where_clause=true, bool $force_limit=false, bool $from_cache=false) Executes SELECT * FROM table_name WHERE ...
|
public array | selectOne(string $fields=' *', string $extra_criteria='', string $sortby='', string $sortdirection='ASC', bool $add_where_clause=true, bool $force_limit=false, bool $from_cache=false) Returns a single row from SELECT * FROM table_name WHERE ...
|
public string | escapeFieldNames(string $fieldnames, bool $check_if_field_exists=false) Given a comma separated fieldnames, return them escaped with backtick
|
public int | count(type $field_names=' *', type $criteria='', type $from_cache=false) An alias of SELECT COUNT(fieldnames) FROM (this->table) WHERE (criteria)
|
public query result | quickInsert(array $datavalues, string $insert_options=EMPTY_STRING, bool $update_if_duplicate=false, array $update_datavalues=[]) Executes INSERT INTO table_name VALUES ( ... ) ON DUPLICATE KEY UPDATE ...
|
public query result | quickUpdate(array $datavalues, string $unsanitized_where_condition) Executes UPDATE table_name SET field=value WHERE ...
|
public | searchAndReplace(string $field_name, string $search, string $replace, string $where_condition=NULL) Performs search and replace
|
public query result | quickDelete(string $unsanitized_where_condition) Executes DELETE FROM table_name WHERE ....
|
public array | truncate() Executes TRUNCATE TABLE table_name
|
public array | optimize(type $unsanitized_options=EMPTY_STRING) Optimize MySQL table
|
public array | analyze(type $unsanitized_options=EMPTY_STRING) Executes ANALYZE TABLE table_name
|
public string | showCreateTable() Returns the CREATE TABLE syntax of this table
|
public string | escapeFieldName(string $field_name) Escape field name
|
public string | convertDataValuesArrayIntoSQLForInsertOperation(array $array, bool $dont_sanitize=false) Given a key/value pair array, returns the SQL for INSERT statement
|
public string | convertDataValuesArrayIntoSQLForUpdateOperation(array $array, bool $dont_sanitize=false) Given a key/value pair array, returns the SQL for UPDATE statement
|
public | generateSQLSelectStatement($tablename, $fields=' *', $extra_criteria='', $sortby='', $sortdirection='ASC', $start, $end, $add_where_clause=true, $force_limit=false) |