$store
$store : \qfq\Store
Class Database
$store : \qfq\Store
getRowCount() : mixed
Return the number of rows returned by the last call to execute().
If execute() has never been called, returns FALSE.
Number of rows returned by last call to execute(). If Database::execute() has never been called prior a call to this method, false is returned.
getEnumSetValueList(string $table, string $columnName) : array
Get the values for a given ENUM or SET column
string | $table | name of the table |
string | $columnName | name of the column |
if the table or column does not exist, or is not of type ENUM or SET
getTableDefinition(string $table) : array
Get all column definitions for a table. Return Assoc Array:
id bigint(20) NO PRI NULL auto_increment name varchar(128) YES NULL firstname varchar(128) YES NULL gender enum('','male','female') NO male groups set('','a','b','c') NO a
string | $table | table to retrieve column definition from |
column definition of table as returned by SHOW FIELDS FROM as associative array.
sql( $sql, string $mode = ROW_REGULAR, array $parameterArray = array(), string $specificMessage = '', array $keys = array()) : mixed|null
Fires query $sql and fetches result als assoc array (all modes but ROW_KEYS) or as num array (mode: ROW_EKYS). Throws exception.
$mode ROW_REGULAR: Return 2-dimensional assoc array. Every query row is one array row. ROW_IMPLODE_ALL: Return string. All cells of all rows imploded to one string. ROW_EXPECT_0: Return empty string if there is now record row, Else an exception. ROW_EXPECT_1: Return 1-dimensional assoc array if there are exact one row. Else an exception. ROW_EXPECT_0_1: Return empty string if there is no row. Return 1- dimensional assoc array if there is one row. Else an exception. ROW_EXPECT_GE_1: Like 'ROW_REGULAR'. Throws an exception if there is an empty resultset. ROW_KEYS: Return 2-dimensional num(!) array. Every query row is one array row. In $keys are the column names.
$sql | ||
string | $mode | |
array | $parameterArray | |
string | $specificMessage | |
array | $keys |
If no record found, empty string ( ROW_EXPECT_0_1, ROW_EXPECT_1) or empty array (all other modes)
getFieldDefinitionFromTable(string $table, string $columnName) : array
Get database column definition.
If the column is not found in the table, an exception is thrown.
string | $table | name of the table |
string | $columnName | name of the column |
the definition of the column as retrieved by Database::getTableDefinition().
prepareExecute(string $sql, array $parameterArray = array()) : integer|mixed
Execute a prepared SQL statement like SELECT, INSERT, UPDATE, DELETE, SHOW, .
..
Returns the number of selected rows (SELECT, SHOW, ..) or the affected rows (UPDATE) or the last insert id (INSERT)
string | $sql | SQL statement with prepared statement variable. |
array | $parameterArray | parameter array for prepared statement execution. |
fetchAll(string $mode = '', array $keys = array()) : array|boolean|mixed|string
Fetch all rows of the result as associative array.
mode: ROW_IMPLODE_ALL: Return string. All cells of all rows imploded to one string. ROW_KEYS: Retrun num array with column names in $keys default: Return 2-dimensional assoc array
string | $mode | |
array | $keys |
false in case of error. Empty string is returned if the query didn't yield any rows. All rows as Multi Assoc array if $mode!=IMPLODE_ALL. All rows and all columns imploded to one string if $mode=IMPLODE_ALL