TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Dbal\Database\DatabaseConnection Class Reference
Inheritance diagram for TYPO3\CMS\Dbal\Database\DatabaseConnection:
TYPO3\CMS\Core\Database\DatabaseConnection TYPO3\CMS\Dbal\Database\AdodbPreparedStatement

Public Member Functions

 __construct ()
 
 initialize ()
 
 getSpecifics ()
 
 clearCachedFieldInfo ()
 
 cacheFieldInfo ()
 
 exec_INSERTquery ($table, $fields_values, $no_quote_fields=false)
 
 exec_INSERTmultipleRows ($table, array $fields, array $rows, $no_quote_fields=false)
 
 exec_UPDATEquery ($table, $where, $fields_values, $no_quote_fields=false)
 
 exec_DELETEquery ($table, $where)
 
 exec_SELECTquery ($select_fields, $from_table, $where_clause, $groupBy='', $orderBy='', $limit='')
 
 exec_TRUNCATEquery ($table)
 
 INSERTquery ($table, $fields_values, $no_quote_fields=false)
 
 INSERTmultipleRows ($table, array $fields, array $rows, $no_quote_fields=false)
 
 UPDATEquery ($table, $where, $fields_values, $no_quote_fields=false)
 
 DELETEquery ($table, $where)
 
 SELECTquery ($select_fields, $from_table, $where_clause, $groupBy='', $orderBy='', $limit='')
 
 TRUNCATEquery ($table)
 
 prepare_SELECTquery ($select_fields, $from_table, $where_clause, $groupBy='', $orderBy='', $limit='', array $input_parameters=[])
 
 quoteFieldNames ($select_fields)
 
 quoteFromTables ($from_table)
 
 quoteWhereClause ($where_clause)
 
 fullQuoteStr ($str, $table, $allowNull=false)
 
 quoteStr ($str, $table)
 
 quoteName ($name, $handlerKey=null, $useBackticks=false)
 
 MetaType ($type, $table, $maxLength=-1)
 
 getMetadata ($type, $table, $field, $maxLength=-1)
 
 MySQLMetaType ($t)
 
 MySQLActualType ($meta)
 
 getEquivalentIndexDefinition ($indexSQL)
 
 getEquivalentFieldDefinition ($fieldSQL)
 
 sql_error ()
 
 sql_errno ()
 
 sql_num_rows ($res)
 
 sql_fetch_assoc ($res)
 
 sql_fetch_row ($res)
 
 sql_free_result ($res)
 
 sql_insert_id ()
 
 sql_affected_rows ()
 
 sql_data_seek ($res, $seek)
 
 sql_field_metatype ($table, $field)
 
 sql_field_type ($res, $pointer)
 
 sql_query ($query)
 
 sql_pconnect ()
 
 sql_select_db ()
 
 admin_get_tables ()
 
 admin_query ($query)
 
 handler_getFromTableList ($tableList)
 
 handler_init ($handlerKey)
 
 isConnected ()
 
 runningNative ()
 
 runningADOdbDriver ($driver)
 
 getServerVersion ()
 
 debugHandler ($function, $execTime, $inData)
 
 debug_WHERE ($table, $where, $script='')
 
 debug_log ($query, $ms, $data, $join, $errorFlag, $script='')
 
 debug_explain ($query)
 
- Public Member Functions inherited from TYPO3\CMS\Core\Database\DatabaseConnection
static initialize ()
 
 exec_SELECT_mm_query ($select, $local_table, $mm_table, $foreign_table, $whereClause='', $groupBy='', $orderBy='', $limit='')
 
 exec_SELECT_queryArray ($queryParts)
 
 exec_SELECTgetRows ($select_fields, $from_table, $where_clause, $groupBy='', $orderBy='', $limit='', $uidIndexField='')
 
 exec_SELECTgetSingleRow ($select_fields, $from_table, $where_clause, $groupBy='', $orderBy='', $numIndex=false)
 
 exec_SELECTcountRows ($field, $table, $where='1=1')
 
 INSERTquery ($table, $fields_values, $no_quote_fields=false)
 
 SELECTsubquery ($select_fields, $from_table, $where_clause)
 
 SELECT_mm_query ($select, $local_table, $mm_table, $foreign_table, $whereClause='', $groupBy='', $orderBy='', $limit='')
 
 listQuery ($field, $value, $table)
 
 searchQuery ($searchWords, $fields, $table, $constraint=self::AND_Constraint)
 
 prepare_SELECTqueryArray (array $queryParts, array $input_parameters=[])
 
 prepare_PREPAREDquery ($query, array $queryComponents)
 
 fullQuoteStr ($str, $table, $allowNull=false)
 
 fullQuoteArray ($arr, $table, $noQuote=false, $allowNull=false)
 
 quoteStr ($str, $table)
 
 escapeStrForLike ($str, $table)
 
 cleanIntArray ($arr)
 
 cleanIntList ($list)
 
 stripOrderBy ($str)
 
 stripGroupBy ($str)
 
 splitGroupOrderLimit ($str)
 
 getDateTimeFormats ($table)
 
 sql_query ($query)
 
 sql_error ()
 
 sql_errno ()
 
 sql_num_rows ($res)
 
 sql_fetch_assoc ($res)
 
 sql_fetch_row ($res)
 
 sql_free_result ($res)
 
 sql_insert_id ()
 
 sql_affected_rows ()
 
 sql_data_seek ($res, $seek)
 
 sql_field_type ($res, $pointer)
 
 sql_pconnect ()
 
 sql_select_db ()
 
 admin_get_dbs ()
 
 admin_get_tables ()
 
 admin_get_fields ($tableName)
 
 admin_get_keys ($tableName)
 
 admin_get_charsets ()
 
 admin_query ($query)
 
 setDatabaseHost ($host='localhost')
 
 setDatabasePort ($port=3306)
 
 setDatabaseSocket ($socket=null)
 
 setDatabaseName ($name)
 
 setDatabaseUsername ($username)
 
 setDatabasePassword ($password)
 
 setPersistentDatabaseConnection ($persistentDatabaseConnection)
 
 setConnectionCompression ($connectionCompression)
 
 setInitializeCommandsAfterConnect (array $commands)
 
 setConnectionCharset ($connectionCharset='utf8')
 
 connectDB ()
 
 isConnected ()
 
 getDatabaseHandle ()
 
 setDatabaseHandle ($handle)
 
 getServerVersion ()
 
 debug ($func, $query='')
 
 debug_check_recordset ($res)
 
 __sleep ()
 

Public Attributes

 $debug = false
 
 $conf = []
 
 $mapping = []
 
 $handlerCfg
 
 $handlerInstance = []
 
 $lastHandlerKey = ''
 
 $cache_autoIncFields = []
 
 $cache_fieldType = []
 
 $cache_primaryKeys = []
 
 $SQLparser
 
 MYSQLI_TYPE_CHAR
 
- Public Attributes inherited from TYPO3\CMS\Core\Database\DatabaseConnection
const AND_Constraint = 'AND'
 
const OR_Constraint = 'OR'
 
 $debugOutput = false
 
 $debug_lastBuiltQuery = ''
 
 $store_lastBuiltQuery = false
 
 $explainOutput = 0
 
 $default_charset = 'utf8'
 

Protected Member Functions

 getFieldInfoCache ()
 
 analyzeCachingTables ()
 
 analyzeExtensionTables ()
 
 parseAndAnalyzeSql ($sql)
 
 getCompleteFieldInformation ()
 
 getCacheableString (array $fieldInformation)
 
 analyzeFields ($parsedExtSQL)
 
 mapCachedFieldInfo (array $fieldInfo)
 
 exec_query (array $queryParts)
 
 query ($query)
 
 SELECTqueryFromArray (array $params)
 
 compileSelectParameters (array $params)
 
 getQueryComponents ($select_fields, $from_table, $where_clause, $groupBy, $orderBy, $limit)
 
 precompileSELECTquery (array $components)
 
 quoteSELECTsubquery (array $components)
 
 _quoteFieldNames (array $select_fields)
 
 _quoteFromTables (array $from_table)
 
 _quoteWhereClause (array $where_clause)
 
 quoteGroupBy ($groupBy)
 
 _quoteGroupBy (array $groupBy)
 
 quoteOrderBy ($orderBy)
 
 _quoteOrderBy (array $orderBy)
 
 updateLastInsertId ($table, array $fieldValues)
 
 determineHandlerType ($res)
 
 map_needMapping ($tableList, $fieldMappingOnly=false, array &$parsedTableList=[])
 
 map_assocArray ($input, $tables, $rev=false)
 
 map_remapSELECTQueryParts ($select_fields, $from_table, $where_clause, $groupBy, $orderBy)
 
 getMappingKey ($tableName)
 
 getFreeMappingKey ($tableName)
 
 map_sqlParts (&$sqlPartArray, $defaultTable)
 
 map_subquery (&$parsedQuery)
 
 map_genericQueryParsed (&$parsedQuery)
 
 map_fieldNamesInArray ($table, &$fieldArray)
 
- Protected Member Functions inherited from TYPO3\CMS\Core\Database\DatabaseConnection
 query ($query)
 
 getSelectMmQueryParts ($select, $local_table, $mm_table, $foreign_table, $whereClause='', $groupBy='', $orderBy='', $limit='')
 
 checkConnectionCharset ()
 
 disconnectIfConnected ()
 
 explain ($query, $from_table, $row_count)
 

Protected Attributes

 $printErrors = false
 
 $table2handlerKeys = []
 
 $lastQuery = ''
 
 $lastParsedAndMappedQueryArray = []
 
 $resourceIdToTableNameMap = []
 
 $cache_handlerKeyFromTableList = []
 
 $cache_mappingFromTableList = []
 
 $cacheIdentifier = 'DatabaseConnection_fieldInfo'
 
 $installerSql = null
 
 $queryCache
 
 $mysqlDataTypeMapping
 
 $dbmsSpecifics
 
- Protected Attributes inherited from TYPO3\CMS\Core\Database\DatabaseConnection
 $databaseHost = ''
 
 $databasePort = 3306
 
 $databaseSocket = null
 
 $databaseName = ''
 
 $databaseUsername = ''
 
 $databaseUserPassword = ''
 
 $persistentDatabaseConnection = false
 
 $connectionCompression = false
 
 $connectionCharset = 'utf8'
 
 $initializeCommandsAfterConnect = []
 
 $isConnected = false
 
 $link = null
 
 $preProcessHookObjects = []
 
 $postProcessHookObjects = []
 

Additional Inherited Members

- Static Protected Attributes inherited from TYPO3\CMS\Core\Database\DatabaseConnection
static $dateTimeFormats
 

Detailed Description

TYPO3 database abstraction layer

Definition at line 22 of file DatabaseConnection.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Dbal\Database\DatabaseConnection::__construct ( )

Constructor. Creates SQL parser object and imports configuration from $TYPO3_CONF_VARS['EXTCONF']['dbal']

Definition at line 210 of file DatabaseConnection.php.

References $GLOBALS, and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

Member Function Documentation

◆ _quoteFieldNames()

TYPO3\CMS\Dbal\Database\DatabaseConnection::_quoteFieldNames ( array  $select_fields)
protected

◆ _quoteFromTables()

TYPO3\CMS\Dbal\Database\DatabaseConnection::_quoteFromTables ( array  $from_table)
protected

◆ _quoteGroupBy()

TYPO3\CMS\Dbal\Database\DatabaseConnection::_quoteGroupBy ( array  $groupBy)
protected

Quotes field names in a SQL GROUP BY clause according to DB rules

Parameters
array$groupByThe parsed GROUP BY clause to quote
Returns
array
See also
quoteGroupBy()

Definition at line 1886 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\quoteName().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\prepare_SELECTquery(), TYPO3\CMS\Dbal\Database\DatabaseConnection\quoteGroupBy(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\SELECTqueryFromArray().

◆ _quoteOrderBy()

TYPO3\CMS\Dbal\Database\DatabaseConnection::_quoteOrderBy ( array  $orderBy)
protected

Quotes field names in a SQL ORDER BY clause according to DB rules

Parameters
array$orderByThe parsed ORDER BY clause to quote
Returns
array
See also
quoteOrderBy()

Definition at line 1924 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\quoteName().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\prepare_SELECTquery(), TYPO3\CMS\Dbal\Database\DatabaseConnection\quoteOrderBy(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\SELECTqueryFromArray().

◆ _quoteWhereClause()

◆ admin_get_tables()

TYPO3\CMS\Dbal\Database\DatabaseConnection::admin_get_tables ( )

◆ admin_query()

◆ analyzeCachingTables()

TYPO3\CMS\Dbal\Database\DatabaseConnection::analyzeCachingTables ( )
protected

Loop through caching configurations to find the usage of database backends and parse and analyze table definitions

Returns
void

Definition at line 316 of file DatabaseConnection.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\parseAndAnalyzeSql().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\cacheFieldInfo().

◆ analyzeExtensionTables()

TYPO3\CMS\Dbal\Database\DatabaseConnection::analyzeExtensionTables ( )
protected

Loop over all installed extensions parse and analyze table definitions (if any)

Returns
void

Definition at line 328 of file DatabaseConnection.php.

References $GLOBALS, and TYPO3\CMS\Dbal\Database\DatabaseConnection\parseAndAnalyzeSql().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\cacheFieldInfo().

◆ analyzeFields()

TYPO3\CMS\Dbal\Database\DatabaseConnection::analyzeFields (   $parsedExtSQL)
protected

Analyzes fields and adds the extracted information to the field type, auto increment and primary key info caches.

Parameters
array$parsedExtSQLThe output produced by ->getFieldDefinitions_fileContent()
Returns
void

Definition at line 386 of file DatabaseConnection.php.

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\parseAndAnalyzeSql().

◆ cacheFieldInfo()

◆ clearCachedFieldInfo()

TYPO3\CMS\Dbal\Database\DatabaseConnection::clearCachedFieldInfo ( )

Clears the cached field information file.

Returns
void

Definition at line 281 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\getFieldInfoCache().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\admin_query().

◆ compileSelectParameters()

TYPO3\CMS\Dbal\Database\DatabaseConnection::compileSelectParameters ( array  $params)
protected

Compiles and returns an array of SELECTquery parameters (without $limit) to be used with SELECTquery() or exec_SELECTquery().

Parameters
array$params
Returns
array array($select_fields, $from_table, $where_clause, $groupBy, $orderBy)

Definition at line 1318 of file DatabaseConnection.php.

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_SELECTquery(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\SELECTqueryFromArray().

◆ debug_explain()

TYPO3\CMS\Dbal\Database\DatabaseConnection::debug_explain (   $query)

Perform EXPLAIN query on DEFAULT handler!

Parameters
string$querySELECT Query
Returns
array The Explain result rows in an array

Definition at line 4017 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\sql_fetch_assoc(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\sql_query().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\debugHandler().

◆ debug_log()

TYPO3\CMS\Dbal\Database\DatabaseConnection::debug_log (   $query,
  $ms,
  $data,
  $join,
  $errorFlag,
  $script = '' 
)

Inserts row in the log table

Parameters
string$queryThe current query
int$msExecution time of query in milliseconds
array$dataData to be stored serialized.
string$joinJoin string if there IS a join.
int$errorFlagError status.
string$scriptThe script calling the logging
Returns
void

Definition at line 3985 of file DatabaseConnection.php.

References $GLOBALS, and TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_INSERTquery().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\debugHandler().

◆ debug_WHERE()

TYPO3\CMS\Dbal\Database\DatabaseConnection::debug_WHERE (   $table,
  $where,
  $script = '' 
)

Logs the where clause for debugging purposes.

Parameters
string$tableTable name(s) the query was targeted at
string$whereThe WHERE clause to be logged
string$scriptThe script calling the logging
Returns
void

Definition at line 3962 of file DatabaseConnection.php.

References $GLOBALS, and TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_INSERTquery().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\debugHandler().

◆ debugHandler()

◆ DELETEquery()

TYPO3\CMS\Core\Database\DatabaseConnection::DELETEquery (   $table,
  $where 
)

Creates a DELETE SQL-statement for $table where $where-clause

Parameters
string$tableSee exec_DELETEquery()
string$whereSee exec_DELETEquery()
Returns
string Full SQL query for DELETE
Exceptions

Definition at line 1218 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\quoteFromTables(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\quoteWhereClause().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_DELETEquery().

◆ determineHandlerType()

TYPO3\CMS\Dbal\Database\DatabaseConnection::determineHandlerType (   $res)
protected

◆ exec_DELETEquery()

TYPO3\CMS\Core\Database\DatabaseConnection::exec_DELETEquery (   $table,
  $where 
)

◆ exec_INSERTmultipleRows()

TYPO3\CMS\Core\Database\DatabaseConnection::exec_INSERTmultipleRows (   $table,
array  $fields,
array  $rows,
  $no_quote_fields = false 
)

Creates and executes an INSERT SQL-statement for $table with multiple rows.

Parameters
string$tableTable name
array$fieldsField names
array$rowsTable rows. Each row should be an array with field values mapping to $fields
bool | array | string$no_quote_fieldsSee fullQuoteArray()
Returns
bool||object MySQLi result object / DBAL object

Definition at line 618 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_INSERTquery(), TYPO3\CMS\Dbal\Database\DatabaseConnection\handler_getFromTableList(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\query().

◆ exec_INSERTquery()

TYPO3\CMS\Core\Database\DatabaseConnection::exec_INSERTquery (   $table,
  $fields_values,
  $no_quote_fields = false 
)

Creates and executes an INSERT SQL-statement for $table from the array with field/value pairs $fields_values. Using this function specifically allows us to handle BLOB and CLOB fields depending on DB

Parameters
string$tableTable name
array$fields_valuesField values as key=>value pairs. Values will be escaped internally. Typically you would fill an array like "$insertFields" with 'fieldname'=>'value' and pass it to this function as argument.
bool | array | string$no_quote_fieldsSee fullQuoteArray()
Returns
bool||object MySQLi result object / DBAL object
Exceptions

Definition at line 485 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\$lastHandlerKey, TYPO3\CMS\Core\Database\DatabaseConnection\debug(), TYPO3\CMS\Dbal\Database\DatabaseConnection\debugHandler(), TYPO3\CMS\Dbal\Database\DatabaseConnection\fullQuoteStr(), TYPO3\CMS\Dbal\Database\DatabaseConnection\handler_getFromTableList(), TYPO3\CMS\Dbal\Database\DatabaseConnection\INSERTquery(), TYPO3\CMS\Dbal\Database\DatabaseConnection\map_assocArray(), TYPO3\CMS\Dbal\Database\DatabaseConnection\map_needMapping(), TYPO3\CMS\Core\Utility\GeneralUtility\milliseconds(), TYPO3\CMS\Dbal\Database\DatabaseConnection\query(), TYPO3\CMS\Dbal\Database\DatabaseConnection\quoteFromTables(), TYPO3\CMS\Dbal\Database\DatabaseConnection\quoteWhereClause(), TYPO3\CMS\Dbal\Database\DatabaseConnection\sql_error(), TYPO3\CMS\Dbal\Database\DatabaseConnection\sql_insert_id(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\updateLastInsertId().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\admin_query(), TYPO3\CMS\Dbal\Database\DatabaseConnection\debug_log(), TYPO3\CMS\Dbal\Database\DatabaseConnection\debug_WHERE(), TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_INSERTmultipleRows(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_query().

◆ exec_query()

TYPO3\CMS\Dbal\Database\DatabaseConnection::exec_query ( array  $queryParts)
protected

◆ exec_SELECTquery()

TYPO3\CMS\Core\Database\DatabaseConnection::exec_SELECTquery (   $select_fields,
  $from_table,
  $where_clause,
  $groupBy = '',
  $orderBy = '',
  $limit = '' 
)

Creates and executes a SELECT SQL-statement Using this function specifically allow us to handle the LIMIT feature independently of DB.

Parameters
string$select_fieldsList of fields to select from the table. This is what comes right after "SELECT ...". Required value.
string$from_tableTable(s) from which to select. This is what comes right after "FROM ...". Required value.
string$where_clauseAdditional WHERE clauses put in the end of the query. NOTICE: You must escape values in this argument with $this->fullQuoteStr() yourself! DO NOT PUT IN GROUP BY, ORDER BY or LIMIT!
string$groupByOptional GROUP BY field(s), if none, supply blank string.
string$orderByOptional ORDER BY field(s), if none, supply blank string.
string$limitOptional LIMIT value ([begin,]max), if none, supply blank string.
Exceptions

Definition at line 795 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\$lastHandlerKey, TYPO3\CMS\Dbal\Database\DatabaseConnection\compileSelectParameters(), TYPO3\CMS\Core\Database\DatabaseConnection\debug(), TYPO3\CMS\Dbal\Database\DatabaseConnection\debugHandler(), TYPO3\CMS\Dbal\Database\DatabaseConnection\handler_getFromTableList(), TYPO3\CMS\Core\Utility\GeneralUtility\intExplode(), TYPO3\CMS\Dbal\Database\DatabaseConnection\map_needMapping(), TYPO3\CMS\Dbal\Database\DatabaseConnection\map_remapSELECTQueryParts(), TYPO3\CMS\Core\Utility\GeneralUtility\milliseconds(), TYPO3\CMS\Dbal\Database\DatabaseConnection\query(), TYPO3\CMS\Dbal\Database\DatabaseConnection\SELECTquery(), TYPO3\CMS\Dbal\Database\DatabaseConnection\SELECTqueryFromArray(), TYPO3\CMS\Dbal\Database\DatabaseConnection\sql_error(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\sql_num_rows().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_query().

◆ exec_TRUNCATEquery()

◆ exec_UPDATEquery()

TYPO3\CMS\Core\Database\DatabaseConnection::exec_UPDATEquery (   $table,
  $where,
  $fields_values,
  $no_quote_fields = false 
)

Creates and executes an UPDATE SQL-statement for $table where $where-clause (typ. 'uid=...') from the array with field/value pairs $fields_values. Using this function specifically allow us to handle BLOB and CLOB fields depending on DB

Parameters
string$tableDatabase tablename
string$whereWHERE clause, eg. "uid=1". NOTICE: You must escape values in this argument with $this->fullQuoteStr() yourself!
array$fields_valuesField values as key=>value pairs. Values will be escaped internally. Typically you would fill an array like "$updateFields" with 'fieldname'=>'value' and pass it to this function as argument.
bool | array | string$no_quote_fieldsSee fullQuoteArray()
Returns
bool||object MySQLi result object / DBAL object

Definition at line 649 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\$lastHandlerKey, TYPO3\CMS\Core\Database\DatabaseConnection\debug(), TYPO3\CMS\Dbal\Database\DatabaseConnection\debugHandler(), TYPO3\CMS\Dbal\Database\DatabaseConnection\fullQuoteStr(), TYPO3\CMS\Dbal\Database\DatabaseConnection\handler_getFromTableList(), TYPO3\CMS\Dbal\Database\DatabaseConnection\map_assocArray(), TYPO3\CMS\Dbal\Database\DatabaseConnection\map_needMapping(), TYPO3\CMS\Dbal\Database\DatabaseConnection\map_sqlParts(), TYPO3\CMS\Core\Utility\GeneralUtility\milliseconds(), TYPO3\CMS\Dbal\Database\DatabaseConnection\query(), TYPO3\CMS\Dbal\Database\DatabaseConnection\quoteFromTables(), TYPO3\CMS\Dbal\Database\DatabaseConnection\quoteWhereClause(), TYPO3\CMS\Dbal\Database\DatabaseConnection\sql_error(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\UPDATEquery().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_query().

◆ fullQuoteStr()

TYPO3\CMS\Dbal\Database\DatabaseConnection::fullQuoteStr (   $str,
  $table,
  $allowNull = false 
)

Escaping and quoting values for SQL statements.

Parameters
string$strInput string
string$tableTable name for which to quote string. Just enter the table that the field-value is selected from (and any DBAL will look up which handler to use and then how to quote the string!).
bool$allowNullWhether to allow NULL values
Returns
string Output string; Wrapped in single quotes and quotes in the string (" / ') and \ will be backslashed (or otherwise based on DBAL handler)
See also
quoteStr()

Definition at line 1952 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\quoteStr().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_INSERTquery(), TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_UPDATEquery(), TYPO3\CMS\Dbal\Database\DatabaseConnection\INSERTquery(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\UPDATEquery().

◆ getCacheableString()

TYPO3\CMS\Dbal\Database\DatabaseConnection::getCacheableString ( array  $fieldInformation)
protected

Creates a PHP code representation of the array that can be cached in the PHP code cache.

Parameters
array$fieldInformation
Returns
string

Definition at line 372 of file DatabaseConnection.php.

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\cacheFieldInfo().

◆ getCompleteFieldInformation()

TYPO3\CMS\Dbal\Database\DatabaseConnection::getCompleteFieldInformation ( )
protected

◆ getEquivalentFieldDefinition()

TYPO3\CMS\Dbal\Database\DatabaseConnection::getEquivalentFieldDefinition (   $fieldSQL)

Convert the native MySQL Field type to the closest matching equivalent field type supported by the DBMS. INTEGER and TINYTEXT colums need to be further processed due to MySQL limitations / non-standard features.

Parameters
string$fieldSQL
Returns
string

Definition at line 2163 of file DatabaseConnection.php.

◆ getEquivalentIndexDefinition()

TYPO3\CMS\Dbal\Database\DatabaseConnection::getEquivalentIndexDefinition (   $indexSQL)

Remove the index prefix length information from columns in an index definition. Partial indexes based on a prefix are not supported by all databases.

Parameters
string$indexSQL
Returns
string

Definition at line 2139 of file DatabaseConnection.php.

◆ getFieldInfoCache()

TYPO3\CMS\Dbal\Database\DatabaseConnection::getFieldInfoCache ( )
protected

◆ getFreeMappingKey()

TYPO3\CMS\Dbal\Database\DatabaseConnection::getFreeMappingKey (   $tableName)
protected

Returns a free key to be used to store mapping information in $this->mapping.

Parameters
string$tableName
Returns
string

Definition at line 3524 of file DatabaseConnection.php.

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\map_remapSELECTQueryParts(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\map_subquery().

◆ getMappingKey()

TYPO3\CMS\Dbal\Database\DatabaseConnection::getMappingKey (   $tableName)
protected

Returns the key to be used when retrieving information from $this->mapping. This ensures that mapping from aliased tables is properly retrieved.

Parameters
string$tableName
Returns
string

Definition at line 3509 of file DatabaseConnection.php.

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\map_assocArray(), TYPO3\CMS\Dbal\Database\DatabaseConnection\map_remapSELECTQueryParts(), TYPO3\CMS\Dbal\Database\DatabaseConnection\map_sqlParts(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\map_subquery().

◆ getMetadata()

TYPO3\CMS\Dbal\Database\DatabaseConnection::getMetadata (   $type,
  $table,
  $field,
  $maxLength = -1 
)

Return Metadata for native field type (ADOdb only!)

Parameters
string$typeNative type as reported by admin_get_fields()
string$tableTable name for which the type is queried. Important for detection of DBMS handler of the query!
string$fieldField name for which the type is queried. Important for accessing the field information cache.
int$maxLength
Exceptions

Definition at line 2051 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\$lastHandlerKey, $rs, TYPO3\CMS\Dbal\Database\DatabaseConnection\handler_getFromTableList(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\quoteFromTables().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\admin_get_tables(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\MetaType().

◆ getQueryComponents()

TYPO3\CMS\Dbal\Database\DatabaseConnection::getQueryComponents (   $select_fields,
  $from_table,
  $where_clause,
  $groupBy,
  $orderBy,
  $limit 
)
protected

Returns the parsed query components.

Parameters
string$select_fields
string$from_table
string$where_clause
string$groupBy
string$orderBy
string$limit
Exceptions

Definition at line 1457 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\handler_getFromTableList(), TYPO3\CMS\Core\Utility\GeneralUtility\intExplode(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\runningADOdbDriver().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\prepare_SELECTquery().

◆ getServerVersion()

TYPO3\CMS\Dbal\Database\DatabaseConnection::getServerVersion ( )

Get the SQL server version

Returns
string

Definition at line 3297 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\$lastHandlerKey.

◆ getSpecifics()

TYPO3\CMS\Dbal\Database\DatabaseConnection::getSpecifics ( )

Gets the DBMS specifics object

Returns
Specifics

Definition at line 263 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\$dbmsSpecifics.

◆ handler_getFromTableList()

TYPO3\CMS\Dbal\Database\DatabaseConnection::handler_getFromTableList (   $tableList)

◆ handler_init()

◆ initialize()

TYPO3\CMS\Dbal\Database\DatabaseConnection::initialize ( )

◆ INSERTmultipleRows()

TYPO3\CMS\Core\Database\DatabaseConnection::INSERTmultipleRows (   $table,
array  $fields,
array  $rows,
  $no_quote_fields = false 
)

Creates an INSERT SQL-statement for $table with multiple rows.

Parameters
string$tableTable name
array$fieldsField names
array$rowsTable rows. Each row should be an array with field values mapping to $fields
bool | array | string$no_quote_fieldsSee fullQuoteArray()
Returns
string|array Full SQL query for INSERT (unless $rows does not contain any elements in which case it will be FALSE)

Creates an INSERT SQL-statement for $table with multiple rows.

Parameters
string$tableTable name
array$fieldsField names
array$rowsTable rows. Each row should be an array with field values mapping to $fields
bool | array | string$no_quote_fieldsSee fullQuoteArray()
Returns
string|NULL Full SQL query for INSERT, NULL if $rows is empty

Definition at line 1105 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\INSERTquery().

◆ INSERTquery()

TYPO3\CMS\Dbal\Database\DatabaseConnection::INSERTquery (   $table,
  $fields_values,
  $no_quote_fields = false 
)

◆ isConnected()

◆ map_assocArray()

TYPO3\CMS\Dbal\Database\DatabaseConnection::map_assocArray (   $input,
  $tables,
  $rev = false 
)
protected

Takes an associated array with field => value pairs and remaps the field names if configured for this table in $this->mapping array. Be careful not to map a field name to another existing fields name (although you can use this to swap fieldnames of course...:-) Observe mapping problems with join-results (more than one table): Joined queries should always prefix the table name to avoid problems with this. Observe that alias fields are not mapped of course (should not be a problem though)

Parameters
array$inputInput array, associative keys
array$tablesArray of tables from the query. Normally just one table; many tables in case of a join. NOTICE: for multiple tables (with joins) there MIGHT occur trouble with fields of the same name in the two tables: This function traverses the mapping information for BOTH tables and applies mapping without checking from which table the field really came!
bool$revIf TRUE, reverse direction. Default direction is to map an array going INTO the database (thus mapping TYPO3 fieldnames to PHYSICAL field names!)
Returns
array Output array, with mapped associative keys.

Definition at line 3378 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\getMappingKey().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_INSERTquery(), TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_UPDATEquery(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\sql_fetch_assoc().

◆ map_fieldNamesInArray()

TYPO3\CMS\Dbal\Database\DatabaseConnection::map_fieldNamesInArray (   $table,
$fieldArray 
)
protected

Re-mapping field names in array

Parameters
string$table(TYPO3) Table name for fields.
array$fieldArrayArray of fieldnames to remap. Notice: Passed by reference!
Returns
void

Definition at line 3798 of file DatabaseConnection.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\map_genericQueryParsed().

◆ map_genericQueryParsed()

TYPO3\CMS\Dbal\Database\DatabaseConnection::map_genericQueryParsed ( $parsedQuery)
protected

Will do table/field mapping on a general -compliant SQL query (May still not support all query types...)

Parameters
array$parsedQueryParsed QUERY as from ::parseSQL(). NOTICE: Passed by reference!
Exceptions

Definition at line 3738 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\map_fieldNamesInArray(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\map_needMapping().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\admin_query().

◆ map_needMapping()

TYPO3\CMS\Dbal\Database\DatabaseConnection::map_needMapping (   $tableList,
  $fieldMappingOnly = false,
array &  $parsedTableList = [] 
)
protected

Checks if mapping is needed for a table(list)

Parameters
string$tableListList of tables in query
bool$fieldMappingOnlyIf TRUE, it will check only if FIELDs are configured and ignore the mapped table name if any.
array$parsedTableListParsed list of tables, should be passed as reference to be reused and prevent double parsing
Returns
mixed Returns an array of table names (parsed version of input table) if mapping is needed, otherwise just FALSE.

Definition at line 3328 of file DatabaseConnection.php.

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\admin_get_tables(), TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_DELETEquery(), TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_INSERTquery(), TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_SELECTquery(), TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_TRUNCATEquery(), TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_UPDATEquery(), TYPO3\CMS\Dbal\Database\DatabaseConnection\map_genericQueryParsed(), TYPO3\CMS\Dbal\Database\DatabaseConnection\prepare_SELECTquery(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\sql_fetch_assoc().

◆ map_remapSELECTQueryParts()

TYPO3\CMS\Dbal\Database\DatabaseConnection::map_remapSELECTQueryParts (   $select_fields,
  $from_table,
  $where_clause,
  $groupBy,
  $orderBy 
)
protected

Remaps table/field names in a SELECT query's parts

Parameters
mixed$select_fieldsEither parsed list of tables (SQLparser->parseFromTables()) or list of fields to select from the table. This is what comes right after "SELECT ...". Required value.
string$from_tableTable(s) from which to select. This is what comes right after "FROM ...". Require value.
string$where_clauseWhere clause. This is what comes right after "WHERE ...". Can be blank.
string$groupByGroup by field(s)
string$orderByOrder by field(s)
Returns
array
See also
exec_SELECTquery()

Definition at line 3421 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\$mapping, TYPO3\CMS\Dbal\Database\DatabaseConnection\getFreeMappingKey(), TYPO3\CMS\Dbal\Database\DatabaseConnection\getMappingKey(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\map_sqlParts().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_SELECTquery(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\prepare_SELECTquery().

◆ map_sqlParts()

TYPO3\CMS\Dbal\Database\DatabaseConnection::map_sqlParts ( $sqlPartArray,
  $defaultTable 
)
protected

Generic mapping of table/field names arrays (as parsed by )

Parameters
array$sqlPartArrayArray with parsed SQL parts; Takes both fields, tables, where-parts, group and order-by. Passed by reference.
string$defaultTableDefault table name to assume if no table is found in $sqlPartArray
Returns
void
See also
map_remapSELECTQueryParts()

Definition at line 3540 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\getMappingKey(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\map_subquery().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_DELETEquery(), TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_UPDATEquery(), TYPO3\CMS\Dbal\Database\DatabaseConnection\map_remapSELECTQueryParts(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\map_subquery().

◆ map_subquery()

TYPO3\CMS\Dbal\Database\DatabaseConnection::map_subquery ( $parsedQuery)
protected

◆ mapCachedFieldInfo()

TYPO3\CMS\Dbal\Database\DatabaseConnection::mapCachedFieldInfo ( array  $fieldInfo)
protected

This function builds all definitions for mapped tables and fields

Parameters
array$fieldInfo
Returns
array
See also
cacheFieldInfo()

Definition at line 426 of file DatabaseConnection.php.

References $GLOBALS.

◆ MetaType()

TYPO3\CMS\Dbal\Database\DatabaseConnection::MetaType (   $type,
  $table,
  $maxLength = -1 
)

Return MetaType for native field type (ADOdb only!)

Parameters
string$typeNative type as reported by admin_get_fields()
string$tableTable name for which query type string. Important for detection of DBMS handler of the query!
int$maxLength
Exceptions

Definition at line 2035 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\getMetadata(), and TYPO3\CMS\Core\Utility\GeneralUtility\logDeprecatedFunction().

◆ MySQLActualType()

TYPO3\CMS\Dbal\Database\DatabaseConnection::MySQLActualType (   $meta)

Return actual MySQL type for meta field type

Parameters
string$metaMeta type (currenly ADOdb syntax only, http://phplens.com/lens/adodb/docs-adodb.htm#metatype)
Returns
string Native type as reported as in mysqldump files, uppercase
Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8

Definition at line 2096 of file DatabaseConnection.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\logDeprecatedFunction().

◆ MySQLMetaType()

TYPO3\CMS\Dbal\Database\DatabaseConnection::MySQLMetaType (   $t)

Return MetaType for native MySQL field type

Parameters
string$tnative type as reported as in mysqldump files
Returns
string Meta type (currently ADOdb syntax only, http://phplens.com/lens/adodb/docs-adodb.htm#metatype)
Deprecated:
since TYPO3 CMS 7, will be removed in TYPO3 CMS 8

Definition at line 2083 of file DatabaseConnection.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\logDeprecatedFunction().

◆ parseAndAnalyzeSql()

TYPO3\CMS\Dbal\Database\DatabaseConnection::parseAndAnalyzeSql (   $sql)
protected

◆ precompileSELECTquery()

◆ prepare_SELECTquery()

TYPO3\CMS\Core\Database\DatabaseConnection::prepare_SELECTquery (   $select_fields,
  $from_table,
  $where_clause,
  $groupBy = '',
  $orderBy = '',
  $limit = '',
array  $input_parameters = [] 
)

Creates a SELECT prepared SQL statement.

Parameters
string$select_fieldsSee exec_SELECTquery()
string$from_tableSee exec_SELECTquery()
string$where_clauseSee exec_SELECTquery()
string$groupBySee exec_SELECTquery()
string$orderBySee exec_SELECTquery()
string$limitSee exec_SELECTquery()
array$input_parametersAn array of values with as many elements as there are bound parameters in the SQL statement being executed. All values are treated as ::PARAM_AUTOTYPE.
Returns
Prepared statement

Definition at line 1365 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\_quoteFieldNames(), TYPO3\CMS\Dbal\Database\DatabaseConnection\_quoteFromTables(), TYPO3\CMS\Dbal\Database\DatabaseConnection\_quoteGroupBy(), TYPO3\CMS\Dbal\Database\DatabaseConnection\_quoteOrderBy(), TYPO3\CMS\Dbal\Database\DatabaseConnection\_quoteWhereClause(), TYPO3\CMS\Core\Database\DatabaseConnection\debug(), TYPO3\CMS\Dbal\Database\DatabaseConnection\debugHandler(), TYPO3\CMS\Core\Utility\GeneralUtility\devLog(), TYPO3\CMS\Dbal\QueryCache\getCacheKey(), TYPO3\CMS\Dbal\Database\DatabaseConnection\getQueryComponents(), TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance(), TYPO3\CMS\Dbal\Database\DatabaseConnection\map_needMapping(), TYPO3\CMS\Dbal\Database\DatabaseConnection\map_remapSELECTQueryParts(), TYPO3\CMS\Core\Utility\GeneralUtility\milliseconds(), TYPO3\CMS\Dbal\Database\DatabaseConnection\precompileSELECTquery(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\runningNative().

◆ query()

◆ quoteFieldNames()

TYPO3\CMS\Dbal\Database\DatabaseConnection::quoteFieldNames (   $select_fields)

◆ quoteFromTables()

◆ quoteGroupBy()

TYPO3\CMS\Dbal\Database\DatabaseConnection::quoteGroupBy (   $groupBy)
protected

Quotes the field (and table) names within a group by clause with the quote character suitable for the DB being used

Parameters
string$groupByA group by clause that can by parsed by parseFieldList
Returns
string Usable group by clause with quoted field/table names

Definition at line 1866 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\_quoteGroupBy(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\runningNative().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\SELECTquery().

◆ quoteName()

TYPO3\CMS\Dbal\Database\DatabaseConnection::quoteName (   $name,
  $handlerKey = null,
  $useBackticks = false 
)

Quotes an object name (table name, field, ...)

Parameters
string$nameObject's name
string$handlerKeyHandler key
bool$useBackticksIf method NameQuote() is not used, whether to use backticks instead of driver-specific quotes
Returns
string Properly-quoted object's name

Definition at line 2009 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\$lastHandlerKey.

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\_quoteFieldNames(), TYPO3\CMS\Dbal\Database\DatabaseConnection\_quoteFromTables(), TYPO3\CMS\Dbal\Database\DatabaseConnection\_quoteGroupBy(), TYPO3\CMS\Dbal\Database\DatabaseConnection\_quoteOrderBy(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\_quoteWhereClause().

◆ quoteOrderBy()

TYPO3\CMS\Dbal\Database\DatabaseConnection::quoteOrderBy (   $orderBy)
protected

Quotes the field (and table) names within an order by clause with the quote character suitable for the DB being used

Parameters
string$orderByAn order by clause that can by parsed by parseFieldList
Returns
string Usable order by clause with quoted field/table names

Definition at line 1904 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\_quoteOrderBy(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\runningNative().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\SELECTquery().

◆ quoteSELECTsubquery()

TYPO3\CMS\Dbal\Database\DatabaseConnection::quoteSELECTsubquery ( array  $components)
protected

◆ quoteStr()

TYPO3\CMS\Dbal\Database\DatabaseConnection::quoteStr (   $str,
  $table 
)

Substitution for PHP function "addslashes()" Use this function instead of the PHP addslashes() function when you build queries - this will prepare your code for DBAL. NOTICE: You must wrap the output of this function in SINGLE QUOTES to be DBAL compatible. Unless you have to apply the single quotes yourself you should rather use ->fullQuoteStr()!

Parameters
string$strInput string
string$tableTable name for which to quote string. Just enter the table that the field-value is selected from (and any DBAL will look up which handler to use and then how to quote the string!).
Exceptions

Definition at line 1971 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\$lastHandlerKey, TYPO3\CMS\Core\Database\DatabaseConnection\connectDB(), TYPO3\CMS\Dbal\Database\DatabaseConnection\handler_getFromTableList(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\isConnected().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\fullQuoteStr(), TYPO3\CMS\Dbal\Database\DatabaseConnection\INSERTquery(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\UPDATEquery().

◆ quoteWhereClause()

TYPO3\CMS\Dbal\Database\DatabaseConnection::quoteWhereClause (   $where_clause)

◆ runningADOdbDriver()

TYPO3\CMS\Dbal\Database\DatabaseConnection::runningADOdbDriver (   $driver)

Checks whether the ADOdb handler is running with a driver that contains the argument

Parameters
string$driverDriver name, matched with strstr().
Returns
bool True if running with the given driver

Definition at line 3287 of file DatabaseConnection.php.

References $driver.

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\_quoteWhereClause(), TYPO3\CMS\Dbal\Database\DatabaseConnection\getQueryComponents(), TYPO3\CMS\Dbal\Database\DatabaseConnection\SELECTquery(), TYPO3\CMS\Dbal\Database\DatabaseConnection\sql_fetch_assoc(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\sql_fetch_row().

◆ runningNative()

◆ SELECTquery()

TYPO3\CMS\Core\Database\DatabaseConnection::SELECTquery (   $select_fields,
  $from_table,
  $where_clause,
  $groupBy = '',
  $orderBy = '',
  $limit = '' 
)

◆ SELECTqueryFromArray()

TYPO3\CMS\Dbal\Database\DatabaseConnection::SELECTqueryFromArray ( array  $params)
protected

◆ sql_affected_rows()

TYPO3\CMS\Dbal\Database\DatabaseConnection::sql_affected_rows ( )

Returns the number of rows affected by the last INSERT, UPDATE or DELETE query

Returns
int Number of rows affected by last query

Definition at line 2476 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\$lastHandlerKey.

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\debugHandler().

◆ sql_data_seek()

TYPO3\CMS\Dbal\Database\DatabaseConnection::sql_data_seek (   $res,
  $seek 
)

Move internal result pointer

Parameters
bool | \mysqli_result | object$resMySQLi result object / DBAL object
int$seekSeek result number.
Returns
bool Returns TRUE on success or FALSE on failure.

Definition at line 2500 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\determineHandlerType().

◆ sql_errno()

TYPO3\CMS\Dbal\Database\DatabaseConnection::sql_errno ( )

Returns the error number on the last query() execution

Returns
int MySQLi error number

Definition at line 2229 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\$lastHandlerKey.

◆ sql_error()

◆ sql_fetch_assoc()

TYPO3\CMS\Dbal\Database\DatabaseConnection::sql_fetch_assoc (   $res)

Returns an associative array that corresponds to the fetched row, or FALSE if there are no more rows. MySQLi fetch_assoc() wrapper function

Parameters
bool | \mysqli_result | object$resMySQLi result object / DBAL object
Returns
array|bool Associative array of result row.

Definition at line 2280 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\determineHandlerType(), TYPO3\CMS\Dbal\Database\DatabaseConnection\map_assocArray(), TYPO3\CMS\Dbal\Database\DatabaseConnection\map_needMapping(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\runningADOdbDriver().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\admin_get_tables(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\debug_explain().

◆ sql_fetch_row()

TYPO3\CMS\Dbal\Database\DatabaseConnection::sql_fetch_row (   $res)

Returns an array that corresponds to the fetched row, or FALSE if there are no more rows. The array contains the values in numerical indices. MySQLi fetch_row() wrapper function

Parameters
bool | \mysqli_result | object$resMySQLi result object / DBAL object
Returns
array|bool Array with result rows.

Definition at line 2350 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\determineHandlerType(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\runningADOdbDriver().

◆ sql_field_metatype()

TYPO3\CMS\Dbal\Database\DatabaseConnection::sql_field_metatype (   $table,
  $field 
)

Get the type of the specified field in a result

If the first parameter is a string, it is used as table name for the lookup.

Parameters
string$tableMySQL result pointer (of SELECT query) / DBAL object / table name
int$fieldField index. In case of ADOdb a string (field name!)
Returns
string Returns the type of the specified field index

Definition at line 2526 of file DatabaseConnection.php.

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\INSERTquery(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\UPDATEquery().

◆ sql_field_type()

TYPO3\CMS\Dbal\Database\DatabaseConnection::sql_field_type (   $res,
  $pointer 
)

Get the type of the specified field in a result mysql_field_type() wrapper function

Parameters
bool | \mysqli_result | object$resMySQLi result object / DBAL object
int$pointerField index.
Returns
string Returns the name of the specified field index, or FALSE on error

Definition at line 2550 of file DatabaseConnection.php.

References TYPO3\CMS\Core\Database\DatabaseConnection\debug(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\determineHandlerType().

◆ sql_free_result()

TYPO3\CMS\Dbal\Database\DatabaseConnection::sql_free_result (   $res)

Free result memory free_result() wrapper function

Parameters
bool | \mysqli_result | object$resMySQLi result object / DBAL object
Returns
bool Returns TRUE on success or FALSE on failure.

Definition at line 2405 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\determineHandlerType().

◆ sql_insert_id()

TYPO3\CMS\Dbal\Database\DatabaseConnection::sql_insert_id ( )

Get the ID generated from the previous INSERT operation

Returns
int The uid of the last inserted record.

Definition at line 2454 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\$lastHandlerKey.

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_INSERTquery().

◆ sql_num_rows()

TYPO3\CMS\Dbal\Database\DatabaseConnection::sql_num_rows (   $res)

Returns the number of selected rows.

Parameters
bool | \mysqli_result | object$resMySQLi result object / DBAL object
Returns
int Number of resulting rows

Definition at line 2252 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\determineHandlerType().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_SELECTquery().

◆ sql_pconnect()

TYPO3\CMS\Dbal\Database\DatabaseConnection::sql_pconnect ( )

Open a (persistent) connection to a MySQL server

Returns
bool|void

Definition at line 2650 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\handler_init().

◆ sql_query()

TYPO3\CMS\Dbal\Database\DatabaseConnection::sql_query (   $query)

Executes query

EXPERIMENTAL - This method will make its best to handle the query correctly but if it cannot, it will simply pass the query to DEFAULT handler.

You should use exec_* function from this class instead! If you don't, anything that does not use the _DEFAULT handler will probably break!

MySQLi query() wrapper function Beware: Use of this method should be avoided as it is experimentally supported by DBAL. You should consider using exec_SELECTquery() and similar methods instead.

Parameters
string$queryQuery to execute
Returns
bool||object MySQLi result object / DBAL object

Definition at line 2607 of file DatabaseConnection.php.

References $GLOBALS, TYPO3\CMS\Core\Database\DatabaseConnection\connectDB(), TYPO3\CMS\Core\Database\DatabaseConnection\debug(), TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_query(), TYPO3\CMS\Dbal\Database\DatabaseConnection\isConnected(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\sql_error().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\debug_explain().

◆ sql_select_db()

◆ TRUNCATEquery()

TYPO3\CMS\Core\Database\DatabaseConnection::TRUNCATEquery (   $table)

Creates a TRUNCATE TABLE SQL-statement

Parameters
string$tableSee exec_TRUNCATEquery()
Returns
string Full SQL query for TRUNCATE TABLE

Definition at line 1334 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\quoteFromTables().

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_TRUNCATEquery().

◆ updateLastInsertId()

TYPO3\CMS\Dbal\Database\DatabaseConnection::updateLastInsertId (   $table,
array  $fieldValues 
)
protected

Update the id information for the last inserted record

Parameters
string$table
array$fieldValues
Returns
null|int

Definition at line 2109 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\$lastHandlerKey.

Referenced by TYPO3\CMS\Dbal\Database\DatabaseConnection\exec_INSERTquery().

◆ UPDATEquery()

TYPO3\CMS\Core\Database\DatabaseConnection::UPDATEquery (   $table,
  $where,
  $fields_values,
  $no_quote_fields = false 
)

Member Data Documentation

◆ $cache_autoIncFields

TYPO3\CMS\Dbal\Database\DatabaseConnection::$cache_autoIncFields = []

◆ $cache_fieldType

TYPO3\CMS\Dbal\Database\DatabaseConnection::$cache_fieldType = []

◆ $cache_handlerKeyFromTableList

TYPO3\CMS\Dbal\Database\DatabaseConnection::$cache_handlerKeyFromTableList = []
protected

Definition at line 117 of file DatabaseConnection.php.

◆ $cache_mappingFromTableList

TYPO3\CMS\Dbal\Database\DatabaseConnection::$cache_mappingFromTableList = []
protected

Definition at line 122 of file DatabaseConnection.php.

◆ $cache_primaryKeys

TYPO3\CMS\Dbal\Database\DatabaseConnection::$cache_primaryKeys = []

◆ $cacheIdentifier

TYPO3\CMS\Dbal\Database\DatabaseConnection::$cacheIdentifier = 'DatabaseConnection_fieldInfo'
protected

Definition at line 143 of file DatabaseConnection.php.

◆ $conf

TYPO3\CMS\Dbal\Database\DatabaseConnection::$conf = []

Definition at line 39 of file DatabaseConnection.php.

◆ $dbmsSpecifics

TYPO3\CMS\Dbal\Database\DatabaseConnection::$dbmsSpecifics
protected

◆ $debug

TYPO3\CMS\Dbal\Database\DatabaseConnection::$debug = false

Definition at line 33 of file DatabaseConnection.php.

◆ $handlerCfg

TYPO3\CMS\Dbal\Database\DatabaseConnection::$handlerCfg
Initial value:
= [
'_DEFAULT' => [
'type' => 'native'

Definition at line 57 of file DatabaseConnection.php.

◆ $handlerInstance

TYPO3\CMS\Dbal\Database\DatabaseConnection::$handlerInstance = []

Definition at line 89 of file DatabaseConnection.php.

◆ $installerSql

TYPO3\CMS\Dbal\Database\DatabaseConnection::$installerSql = null
protected

Definition at line 155 of file DatabaseConnection.php.

◆ $lastHandlerKey

◆ $lastParsedAndMappedQueryArray

TYPO3\CMS\Dbal\Database\DatabaseConnection::$lastParsedAndMappedQueryArray = []
protected

Definition at line 107 of file DatabaseConnection.php.

◆ $lastQuery

TYPO3\CMS\Dbal\Database\DatabaseConnection::$lastQuery = ''
protected

◆ $mapping

TYPO3\CMS\Dbal\Database\DatabaseConnection::$mapping = []

◆ $mysqlDataTypeMapping

TYPO3\CMS\Dbal\Database\DatabaseConnection::$mysqlDataTypeMapping
protected
Initial value:
= [
MYSQLI_TYPE_TINY => 'tinyint'

Definition at line 171 of file DatabaseConnection.php.

◆ $printErrors

TYPO3\CMS\Dbal\Database\DatabaseConnection::$printErrors = false
protected

Definition at line 27 of file DatabaseConnection.php.

◆ $queryCache

TYPO3\CMS\Dbal\Database\DatabaseConnection::$queryCache
protected

Definition at line 162 of file DatabaseConnection.php.

◆ $resourceIdToTableNameMap

TYPO3\CMS\Dbal\Database\DatabaseConnection::$resourceIdToTableNameMap = []
protected

Definition at line 112 of file DatabaseConnection.php.

◆ $SQLparser

TYPO3\CMS\Dbal\Database\DatabaseConnection::$SQLparser

Definition at line 150 of file DatabaseConnection.php.

◆ $table2handlerKeys

TYPO3\CMS\Dbal\Database\DatabaseConnection::$table2handlerKeys = []
protected

Definition at line 51 of file DatabaseConnection.php.

◆ MYSQLI_TYPE_CHAR

TYPO3\CMS\Dbal\Database\DatabaseConnection::MYSQLI_TYPE_CHAR
Initial value:
=> 'tinyint',
MYSQLI_TYPE_SHORT => 'smallint',
MYSQLI_TYPE_LONG => 'int',
MYSQLI_TYPE_FLOAT => 'float',
MYSQLI_TYPE_DOUBLE => 'double',
MYSQLI_TYPE_TIMESTAMP => 'timestamp',
MYSQLI_TYPE_LONGLONG => 'bigint',
MYSQLI_TYPE_INT24 => 'mediumint',
MYSQLI_TYPE_DATE => 'date',
MYSQLI_TYPE_NEWDATE => 'date',
MYSQLI_TYPE_TIME => 'time',
MYSQLI_TYPE_DATETIME => 'datetime',
MYSQLI_TYPE_YEAR => 'year',
MYSQLI_TYPE_BIT => 'bit',
MYSQLI_TYPE_INTERVAL => 'interval',
MYSQLI_TYPE_ENUM => 'enum',
MYSQLI_TYPE_SET => 'set',
MYSQLI_TYPE_TINY_BLOB => 'blob',
MYSQLI_TYPE_MEDIUM_BLOB => 'blob',
MYSQLI_TYPE_LONG_BLOB => 'blob',
MYSQLI_TYPE_BLOB => 'blob',
MYSQLI_TYPE_VAR_STRING => 'varchar',
MYSQLI_TYPE_STRING => 'char',
MYSQLI_TYPE_DECIMAL => 'decimal',
MYSQLI_TYPE_NEWDECIMAL => 'decimal',
MYSQLI_TYPE_GEOMETRY => 'geometry'
]

Definition at line 173 of file DatabaseConnection.php.