TYPO3 CMS  TYPO3_6-2
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 ux_t3lib_DB

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=array())
 
 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)
 
 MySQLMetaType ($t)
 
 MySQLActualType ($meta)
 
 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 ($host=NULL, $username=NULL, $password=NULL)
 
 sql_select_db ($TYPO3_db=NULL)
 
 admin_get_tables ()
 
 admin_query ($query)
 
 handler_getFromTableList ($tableList)
 
 handler_init ($handlerKey)
 
 isConnected ()
 
 runningNative ()
 
 runningADOdbDriver ($driver)
 
 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
 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)
 
 listQuery ($field, $value, $table)
 
 searchQuery ($searchWords, $fields, $table, $constraint=self::AND_Constraint)
 
 prepare_SELECTqueryArray (array $queryParts, array $input_parameters=array())
 
 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 ($host=NULL, $username=NULL, $password=NULL)
 
 sql_select_db ($TYPO3_db=NULL)
 
 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 ($host=NULL, $username=NULL, $password=NULL, $db=NULL)
 
 isConnected ()
 
 getDatabaseHandle ()
 
 setDatabaseHandle ($handle)
 
 debug ($func, $query='')
 
 debug_check_recordset ($res)
 
 __sleep ()
 

Public Attributes

 $debug = FALSE
 
 $conf = array()
 
 $mapping = array()
 
 $handlerCfg
 
 $handlerInstance = array()
 
 $lastHandlerKey = ''
 
 $cache_autoIncFields = array()
 
 $cache_fieldType = array()
 
 $cache_primaryKeys = array()
 
 $SQLparser
 
- 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)
 
 determineHandlerType ($res)
 
 map_needMapping ($tableList, $fieldMappingOnly=FALSE, array &$parsedTableList=array())
 
 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)
 
 setSqlMode ()
 
 checkConnectionCharset ()
 
 disconnectIfConnected ()
 
 handleDeprecatedConnectArguments ($host=NULL, $username=NULL, $password=NULL, $db=NULL)
 
 explain ($query, $from_table, $row_count)
 

Protected Attributes

 $printErrors = FALSE
 
 $table2handlerKeys = array()
 
 $lastQuery = ''
 
 $lastParsedAndMappedQueryArray = array()
 
 $resourceIdToTableNameMap = array()
 
 $cache_handlerKeyFromTableList = array()
 
 $cache_mappingFromTableList = array()
 
 $cacheIdentifier = 't3lib_db_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 = array()
 
 $isConnected = FALSE
 
 $link = NULL
 
 $preProcessHookObjects = array()
 
 $postProcessHookObjects = array()
 

Additional Inherited Members

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

Detailed Description

TYPO3 database abstraction layer

Author
Kasper Skårhøj kaspe.nosp@m.r@ty.nosp@m.po3.c.nosp@m.om
Karsten Dambekalns k.dam.nosp@m.beka.nosp@m.lns@f.nosp@m.ishf.nosp@m.arm.d.nosp@m.e
Xavier Perseguers xavie.nosp@m.r@ty.nosp@m.po3.o.nosp@m.rg

Definition at line 26 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 215 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 1845 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 1881 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 312 of file DatabaseConnection.php.

References 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 322 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 376 of file DatabaseConnection.php.

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

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 279 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 1303 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 3843 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
integer$msExecution time of query in milliseconds
array$dataData to be stored serialized.
string$joinJoin string if there IS a join.
integer$errorFlagError status.
string$scriptThe script calling the logging
Returns
void

Definition at line 3812 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 3790 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 1208 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 619 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 473 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(), and TYPO3\CMS\Dbal\Database\DatabaseConnection\sql_insert_id().

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.
Returns
boolean||object MySQLi result object / DBAL object

Definition at line 792 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 1908 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 363 of file DatabaseConnection.php.

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

◆ getCompleteFieldInformation()

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

Returns all field information gathered during analyzing all tables and fields.

Returns
array

Definition at line 352 of file DatabaseConnection.php.

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

◆ 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 3405 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 3391 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().

◆ 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 1439 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().

◆ 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 1097 of file DatabaseConnection.php.

References $result, and 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 3262 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 3672 of file DatabaseConnection.php.

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 3613 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 = array() 
)
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 3213 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 3304 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 3420 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 415 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 1987 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().

◆ 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

Definition at line 2082 of file DatabaseConnection.php.

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

◆ 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)

Definition at line 2015 of file DatabaseConnection.php.

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

◆ 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 = array() 
)

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 1348 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 1826 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 1963 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 1862 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 1926 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 3196 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
integer Number of rows affected by last query

Definition at line 2393 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
boolean | \mysqli_result | object$resMySQLi result object / DBAL object
integer$seekSeek result number.
Returns
bool Returns TRUE on success or FALSE on failure.

Definition at line 2416 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
integer MySQLi error number

Definition at line 2153 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
boolean | \mysqli_result | object$resMySQLi result object / DBAL object
Returns
array|boolean Associative array of result row.

Definition at line 2202 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
boolean | \mysqli_result | object$resMySQLi result object / DBAL object
Returns
array|boolean Array with result rows.

Definition at line 2271 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
integer$fieldField index. In case of ADOdb a string (field name!)
Returns
string Returns the type of the specified field index

Definition at line 2441 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
boolean | \mysqli_result | object$resMySQLi result object / DBAL object
integer$pointerField index.
Returns
string Returns the name of the specified field index, or FALSE on error

Definition at line 2464 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
boolean | \mysqli_result | object$resMySQLi result object / DBAL object
Returns
bool Returns TRUE on success or FALSE on failure.

Definition at line 2325 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
integer The uid of the last inserted record.

Definition at line 2372 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
boolean | \mysqli_result | object$resMySQLi result object / DBAL object
Returns
integer Number of resulting rows

Definition at line 2175 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 (   $host = NULL,
  $username = NULL,
  $password = NULL 
)

Open a (persistent) connection to a MySQL server

Parameters
string$hostDeprecated since 6.1, will be removed in two versions. Database host IP/domain[:port]
string$usernameDeprecated since 6.1, will be removed in two versions. Username to connect with.
string$passwordDeprecated since 6.1, will be removed in two versions. Password to connect with.
Returns
boolean|void
Exceptions

Definition at line 2563 of file DatabaseConnection.php.

References $host, TYPO3\CMS\Core\Database\DatabaseConnection\handleDeprecatedConnectArguments(), and 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
boolean||object MySQLi result object / DBAL object

Definition at line 2520 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\Core\Utility\GeneralUtility\inList(), 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()

TYPO3\CMS\Dbal\Database\DatabaseConnection::sql_select_db (   $TYPO3_db = NULL)

Select a SQL database

Parameters
string$TYPO3_dbDeprecated since 6.1, will be removed in two versions. Database to connect to.
Returns
bool Returns TRUE on success or FALSE on failure.

Definition at line 2579 of file DatabaseConnection.php.

References TYPO3\CMS\Dbal\Database\DatabaseConnection\$lastHandlerKey, TYPO3\CMS\Core\Database\DatabaseConnection\admin_get_dbs(), TYPO3\CMS\Dbal\Database\DatabaseConnection\query(), TYPO3\CMS\Dbal\Database\DatabaseConnection\sql_error(), and TYPO3\CMS\Core\Utility\GeneralUtility\SYSLOG_SEVERITY_FATAL.

◆ 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 1318 of file DatabaseConnection.php.

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

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

◆ 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 = array()

Definition at line 132 of file DatabaseConnection.php.

◆ $cache_fieldType

TYPO3\CMS\Dbal\Database\DatabaseConnection::$cache_fieldType = array()

Definition at line 137 of file DatabaseConnection.php.

◆ $cache_handlerKeyFromTableList

TYPO3\CMS\Dbal\Database\DatabaseConnection::$cache_handlerKeyFromTableList = array()
protected

Definition at line 121 of file DatabaseConnection.php.

◆ $cache_mappingFromTableList

TYPO3\CMS\Dbal\Database\DatabaseConnection::$cache_mappingFromTableList = array()
protected

Definition at line 126 of file DatabaseConnection.php.

◆ $cache_primaryKeys

TYPO3\CMS\Dbal\Database\DatabaseConnection::$cache_primaryKeys = array()

Definition at line 142 of file DatabaseConnection.php.

◆ $cacheIdentifier

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

Definition at line 147 of file DatabaseConnection.php.

◆ $conf

TYPO3\CMS\Dbal\Database\DatabaseConnection::$conf = array()

Definition at line 43 of file DatabaseConnection.php.

◆ $dbmsSpecifics

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

◆ $debug

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

Definition at line 37 of file DatabaseConnection.php.

◆ $handlerCfg

TYPO3\CMS\Dbal\Database\DatabaseConnection::$handlerCfg
Initial value:
= array(
'_DEFAULT' => array(
'type' => 'native',
'config' => array(
'username' => '',
'password' => '',
'host' => '',
'database' => '',
'driver' => '',
'sequenceStart' => 1,
'useNameQuote' => 0,
'quoteClob' => FALSE
)
)
)

Definition at line 61 of file DatabaseConnection.php.

◆ $handlerInstance

TYPO3\CMS\Dbal\Database\DatabaseConnection::$handlerInstance = array()

Definition at line 93 of file DatabaseConnection.php.

◆ $installerSql

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

Definition at line 160 of file DatabaseConnection.php.

◆ $lastHandlerKey

◆ $lastParsedAndMappedQueryArray

TYPO3\CMS\Dbal\Database\DatabaseConnection::$lastParsedAndMappedQueryArray = array()
protected

Definition at line 111 of file DatabaseConnection.php.

◆ $lastQuery

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

◆ $mapping

TYPO3\CMS\Dbal\Database\DatabaseConnection::$mapping = array()

◆ $mysqlDataTypeMapping

TYPO3\CMS\Dbal\Database\DatabaseConnection::$mysqlDataTypeMapping
protected
Initial value:
= array(
MYSQLI_TYPE_TINY => 'tinyint',
MYSQLI_TYPE_CHAR => '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 176 of file DatabaseConnection.php.

◆ $printErrors

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

Definition at line 31 of file DatabaseConnection.php.

◆ $queryCache

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

Definition at line 167 of file DatabaseConnection.php.

◆ $resourceIdToTableNameMap

TYPO3\CMS\Dbal\Database\DatabaseConnection::$resourceIdToTableNameMap = array()
protected

Definition at line 116 of file DatabaseConnection.php.

◆ $SQLparser

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

Definition at line 155 of file DatabaseConnection.php.

◆ $table2handlerKeys

TYPO3\CMS\Dbal\Database\DatabaseConnection::$table2handlerKeys = array()
protected

Definition at line 55 of file DatabaseConnection.php.