|
static | enableQueryLogging () |
|
static | enableFields ($tableName, $showHidden=-1, array $ignoreArray=array(), $noVersionPreview=FALSE) |
|
static | createRecursivePageList ($startPages, $recursionDepth=0) |
|
static | delete ($tableName, $whereClause) |
|
static | update ($tableName, $whereClause, array $fields) |
|
static | insert ($tableName, array $recordData) |
|
static | select ($fields, $tableNames, $whereClause= '', $groupBy= '', $orderBy= '', $limit= '') |
|
static | selectSingle ($fields, $tableNames, $whereClause= '', $groupBy= '', $orderBy= '', $offset=0) |
|
static | selectMultiple ($fieldNames, $tableNames, $whereClause= '', $groupBy= '', $orderBy= '', $limit= '') |
|
static | selectColumnForMultiple ($fieldName, $tableNames, $whereClause= '', $groupBy= '', $orderBy= '', $limit= '') |
|
static | count ($tableNames, $whereClause= '') |
|
static | existsRecord ($tableName, $whereClause= '') |
|
static | existsExactlyOneRecord ($tableName, $whereClause= '') |
|
static | existsRecordWithUid ($tableName, $uid, $additionalWhereClause= '') |
|
static | getAllTableNames () |
|
static | existsTable ($tableName) |
|
static | getColumnsInTable ($tableName) |
|
static | getColumnDefinition ($tableName, $column) |
|
static | tableHasColumn ($tableName, $column) |
|
static | tableHasColumnUid ($tableName) |
|
static | getTcaForTable ($tableName) |
|
static | getDatabaseConnection () |
|
static Tx_Phpunit_Service_Database::count |
( |
|
$tableNames, |
|
|
|
$whereClause = '' |
|
) |
| |
|
static |
Counts the number of matching records in the database for a particular WHERE clause.
- Parameters
-
string | $tableNames | comma-separated list of existing tables from which to count, can also be a JOIN, must not be empty |
string | $whereClause | WHERE clause, may be empty |
- Returns
- int the number of matching records, will be >= 0
- Exceptions
-
static Tx_Phpunit_Service_Database::createRecursivePageList |
( |
|
$startPages, |
|
|
|
$recursionDepth = 0 |
|
) |
| |
|
static |
Recursively creates a comma-separated list of subpage UIDs from a list of pages. The result also includes the original pages. The maximum level of recursion can be limited: 0 = no recursion (the default value, will return $startPages), 1 = only direct child pages, ..., 250 = all descendants for all sane cases
Note: The returned page list is not sorted.
- Parameters
-
string | $startPages | comma-separated list of page UIDs to start from, must only contain numbers and commas, may be empty |
int | $recursionDepth | maximum depth of recursion, must be >= 0 |
- Returns
- string comma-separated list of subpage UIDs including the UIDs provided in $startPages, will be empty if $startPages is empty
- Exceptions
-
static Tx_Phpunit_Service_Database::delete |
( |
|
$tableName, |
|
|
|
$whereClause |
|
) |
| |
|
static |
Executes a DELETE query.
- Parameters
-
string | $tableName | the name of the table from which to delete, must not be empty |
string | $whereClause | the WHERE clause to select the records, may be empty |
- Returns
- int the number of affected rows, might be 0
- Exceptions
-
static Tx_Phpunit_Service_Database::enableFields |
( |
|
$tableName, |
|
|
|
$showHidden = -1 , |
|
|
array |
$ignoreArray = array() , |
|
|
|
$noVersionPreview = FALSE |
|
) |
| |
|
static |
Wrapper function for ::enableFields() since it is no longer accessible statically.
Returns a part of a WHERE clause which will filter out records with start/end times or deleted/hidden/fe_groups fields set to values that should de-select them according to the current time, preview settings or user login. Is using the $TCA arrays "ctrl" part where the key "enablefields" determines for each table which of these features applies to that table.
- Parameters
-
string | $tableName | table name found in the $TCA array |
int | $showHidden | If $showHidden is set (0/1), any hidden-fields in records are ignored. NOTICE: If you call this function, consider what to do with the show_hidden parameter. |
array | $ignoreArray | Array you can pass where keys can be "disabled", "starttime", "endtime", "fe_group" (keys from "enablefields" in TCA) and if set they will make sure that part of the clause is not added. Thus disables the specific part of the clause. For previewing etc. |
bool | $noVersionPreview | If set, enableFields will be applied regardless of any versioning preview settings which might otherwise disable enableFields. |
- Returns
- string the WHERE clause starting like " AND ...=... AND ...=..."
- Exceptions
-
static Tx_Phpunit_Service_Database::enableQueryLogging |
( |
| ) |
|
|
static |
Enables query logging in TYPO3's DB class.
- Returns
- void
static Tx_Phpunit_Service_Database::existsExactlyOneRecord |
( |
|
$tableName, |
|
|
|
$whereClause = '' |
|
) |
| |
|
static |
Checks whether there is exactly one record in the table given by the first parameter $tableName that matches a given WHERE clause.
- Parameters
-
string | $tableName | the name of the table to query, must not be empty |
string | $whereClause | the WHERE part of the query, may be empty (all records will be counted in that case) |
- Returns
- bool TRUE if there is exactly one matching record, FALSE otherwise
static Tx_Phpunit_Service_Database::existsRecord |
( |
|
$tableName, |
|
|
|
$whereClause = '' |
|
) |
| |
|
static |
Checks whether there are any records in the table given by the first parameter $tableName that match a given WHERE clause.
- Parameters
-
string | $tableName | the name of the table to query, must not be empty |
string | $whereClause | the WHERE part of the query, may be empty (all records will be counted in that case) |
- Returns
- bool TRUE if there is at least one matching record, FALSE otherwise
static Tx_Phpunit_Service_Database::existsRecordWithUid |
( |
|
$tableName, |
|
|
|
$uid, |
|
|
|
$additionalWhereClause = '' |
|
) |
| |
|
static |
Checks whether there is a record in the table given by the first parameter $tableName that has the given UID.
Important: This function also returns TRUE if there is a deleted or hidden record with that particular UID.
- Parameters
-
string | $tableName | the name of the table to query, must not be empty |
int | $uid | the UID of the record to look up, must be > 0 |
string | $additionalWhereClause | additional WHERE clause to append, must either start with " AND" or be completely empty |
- Returns
- bool TRUE if there is a matching record, FALSE otherwise
- Exceptions
-
static Tx_Phpunit_Service_Database::existsTable |
( |
|
$tableName | ) |
|
|
static |
Checks whether a database table exists.
- Parameters
-
string | $tableName | the name of the table to check for, must not be empty |
- Returns
- bool TRUE if the table $tableName exists, FALSE otherwise
- Exceptions
-
static Tx_Phpunit_Service_Database::getAllTableNames |
( |
| ) |
|
|
static |
Returns a list of all table names that are available in the current database.
- Returns
- string[] list of table names
static Tx_Phpunit_Service_Database::getColumnDefinition |
( |
|
$tableName, |
|
|
|
$column |
|
) |
| |
|
static |
Gets the column definition for a field in $tableName.
- Parameters
-
string | $tableName | the name of the table for which the column names should be retrieved, must not be empty |
string | $column | the name of the field of which to retrieve the definition, must not be empty |
- Returns
- array the field definition for the field in $tableName, will not be empty
static Tx_Phpunit_Service_Database::getColumnsInTable |
( |
|
$tableName | ) |
|
|
static |
Gets the column data for a table.
- Parameters
-
string | $tableName | the name of the table for which the column names should be retrieved, must not be empty |
- Returns
- array the column data for the table $tableName with the column names as keys and the SHOW COLUMNS field information (in an array) as values
static Tx_Phpunit_Service_Database::getDatabaseConnection |
( |
| ) |
|
|
static |
Returns $GLOBALS['TYPO3_DB'].
- Returns
- DatabaseConnection
static Tx_Phpunit_Service_Database::getTcaForTable |
( |
|
$tableName | ) |
|
|
static |
Returns the TCA for a certain table.
- Parameters
-
string | $tableName | the table name to look up, must not be empty |
- Returns
- array[] associative array with the TCA description for this table
- Exceptions
-
static Tx_Phpunit_Service_Database::insert |
( |
|
$tableName, |
|
|
array |
$recordData |
|
) |
| |
|
static |
Executes an INSERT query.
- Parameters
-
string | $tableName | the name of the table in which the record should be created, must not be empty |
array | $recordData | key/value pairs of the record to insert, must not be empty |
- Returns
- int the UID of the created record, will be 0 if the table has no UID column
- Exceptions
-
static Tx_Phpunit_Service_Database::select |
( |
|
$fields, |
|
|
|
$tableNames, |
|
|
|
$whereClause = '' , |
|
|
|
$groupBy = '' , |
|
|
|
$orderBy = '' , |
|
|
|
$limit = '' |
|
) |
| |
|
static |
Executes a SELECT query.
- Parameters
-
string | $fields | list of fields to select, may be "*", must not be empty |
string | $tableNames | comma-separated list of tables from which to select, must not be empty |
string | $whereClause | WHERE clause, may be empty |
string | $groupBy | GROUP BY field(s), may be empty |
string | $orderBy | ORDER BY field(s), may be empty |
string | $limit | LIMIT value ([begin,]max), may be empty |
- Returns
- MySQLi result object
- Exceptions
-
static Tx_Phpunit_Service_Database::selectColumnForMultiple |
( |
|
$fieldName, |
|
|
|
$tableNames, |
|
|
|
$whereClause = '' , |
|
|
|
$groupBy = '' , |
|
|
|
$orderBy = '' , |
|
|
|
$limit = '' |
|
) |
| |
|
static |
Executes a SELECT query and returns one column from the result rows as a one-dimensional numeric array.
If there is more than one matching record, only one will be returned.
- Parameters
-
string | $fieldName | name of the field to select, must not be empty |
string | $tableNames | comma-separated list of tables from which to select, must not be empty |
string | $whereClause | WHERE clause, may be empty |
string | $groupBy | GROUP BY field(s), may be empty |
string | $orderBy | ORDER BY field(s), may be empty |
string | $limit | LIMIT value ([begin,]max), may be empty |
- Returns
- string[] one column from the the query result rows, will be empty if there are no matching records
- Exceptions
-
static Tx_Phpunit_Service_Database::selectMultiple |
( |
|
$fieldNames, |
|
|
|
$tableNames, |
|
|
|
$whereClause = '' , |
|
|
|
$groupBy = '' , |
|
|
|
$orderBy = '' , |
|
|
|
$limit = '' |
|
) |
| |
|
static |
Executes a SELECT query and returns the result rows as a two-dimensional associative array.
- Parameters
-
string | $fieldNames | list of fields to select, may be "*", must not be empty |
string | $tableNames | comma-separated list of tables from which to select, must not be empty |
string | $whereClause | WHERE clause, may be empty |
string | $groupBy | GROUP BY field(s), may be empty |
string | $orderBy | ORDER BY field(s), may be empty |
string | $limit | LIMIT value ([begin,]max), may be empty |
- Returns
- array[] the query result rows, will be empty if there are no matching records
- Exceptions
-
static Tx_Phpunit_Service_Database::selectSingle |
( |
|
$fields, |
|
|
|
$tableNames, |
|
|
|
$whereClause = '' , |
|
|
|
$groupBy = '' , |
|
|
|
$orderBy = '' , |
|
|
|
$offset = 0 |
|
) |
| |
|
static |
Executes a SELECT query and returns the single result row as an associative array.
If there is more than one matching record, only one will be returned.
- Parameters
-
string | $fields | list of fields to select, may be "*", must not be empty |
string | $tableNames | comma-separated list of tables from which to select, must not be empty |
string | $whereClause | WHERE clause, may be empty |
string | $groupBy | GROUP BY field(s), may be empty |
string | $orderBy | ORDER BY field(s), may be empty |
int | $offset | the offset to start the result for, must be >= 0 |
- Returns
- string[] the single result row, will not be empty
- Exceptions
-
static Tx_Phpunit_Service_Database::tableHasColumn |
( |
|
$tableName, |
|
|
|
$column |
|
) |
| |
|
static |
Checks whether a table has a column with a particular name.
To get a boolean TRUE as result, the table must contain a column with the given name.
- Parameters
-
string | $tableName | the name of the table to check, must not be empty |
string | $column | the column name to check, must not be empty |
- Returns
- bool TRUE if the column with the provided name exists, FALSE otherwise
static Tx_Phpunit_Service_Database::tableHasColumnUid |
( |
|
$tableName | ) |
|
|
static |
Checks whether a table has a column "uid".
- Parameters
-
string | $tableName | the name of the table to check, must not be empty |
- Returns
- bool TRUE if a valid column was found, FALSE otherwise
static Tx_Phpunit_Service_Database::update |
( |
|
$tableName, |
|
|
|
$whereClause, |
|
|
array |
$fields |
|
) |
| |
|
static |
Executes an UPDATE query.
- Parameters
-
string | $tableName | the name of the table to change, must not be empty |
string | $whereClause | the WHERE clause to select the records, may be empty |
array | $fields | key/value pairs of the fields to change, may be empty |
- Returns
- int the number of affected rows, might be 0
- Exceptions
-
The documentation for this class was generated from the following file:
- Classes/Service/Database.php