TYPO3  7.6
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
DatabaseConnection Class Reference
Inheritance diagram for DatabaseConnection:
DatabaseConnection 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=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)
 
 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 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)
 
 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=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 ()
 
 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 = array()
 
 $mapping = array()
 
 $handlerCfg
 
 $handlerInstance = array()
 
 $lastHandlerKey = ''
 
 $cache_autoIncFields = array()
 
 $cache_fieldType = array()
 
 $cache_primaryKeys = array()
 
 $SQLparser
 
- Public Attributes inherited from 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=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 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 = array()
 
 $lastQuery = ''
 
 $lastParsedAndMappedQueryArray = array()
 
 $resourceIdToTableNameMap = array()
 
 $cache_handlerKeyFromTableList = array()
 
 $cache_mappingFromTableList = array()
 
 $cacheIdentifier = 'DatabaseConnection_fieldInfo'
 
 $installerSql = null
 
 $queryCache
 
 $mysqlDataTypeMapping
 
 $dbmsSpecifics
 
- Protected Attributes inherited from 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 DatabaseConnection
static $dateTimeFormats
 

Detailed Description

TYPO3 database abstraction layer

Definition at line 22 of file dbal/Classes/Database/DatabaseConnection.php.

Constructor & Destructor Documentation

__construct ( )

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

Definition at line 210 of file dbal/Classes/Database/DatabaseConnection.php.

References $GLOBALS, and GeneralUtility\makeInstance().

Member Function Documentation

_quoteFieldNames ( array  $select_fields)
protected

Quotes field (and table) names in a SQL SELECT clause according to DB rules

Parameters
array$select_fieldsThe parsed fields to quote
Returns
array
See Also
quoteFieldNames()

Definition at line 1655 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\_quoteWhereClause(), DatabaseConnection\quoteFieldNames(), and DatabaseConnection\quoteName().

Referenced by DatabaseConnection\prepare_SELECTquery(), DatabaseConnection\quoteFieldNames(), DatabaseConnection\quoteSELECTsubquery(), and DatabaseConnection\SELECTqueryFromArray().

_quoteFromTables ( array  $from_table)
protected

Quotes table names in a SQL FROM clause according to DB rules

Parameters
array$from_tableThe parsed FROM clause to quote
Returns
array
See Also
quoteFromTables()

Definition at line 1712 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\quoteName().

Referenced by DatabaseConnection\prepare_SELECTquery(), DatabaseConnection\quoteFromTables(), DatabaseConnection\quoteSELECTsubquery(), and DatabaseConnection\SELECTqueryFromArray().

_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 1883 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\quoteName().

Referenced by DatabaseConnection\prepare_SELECTquery(), DatabaseConnection\quoteGroupBy(), and DatabaseConnection\SELECTqueryFromArray().

_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 1921 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\quoteName().

Referenced by DatabaseConnection\prepare_SELECTquery(), DatabaseConnection\quoteOrderBy(), and DatabaseConnection\SELECTqueryFromArray().

_quoteWhereClause ( array  $where_clause)
protected
admin_get_tables ( )

Returns the list of tables from the default database, TYPO3_db (quering the DBMS) In a DBAL this method should 1) look up all tables from the DBMS of the _DEFAULT handler and then 2) add all tables configured to be managed by other handlers

Returns
array Array with tablenames as key and arrays with status information as value

Definition at line 2730 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\query(), DatabaseConnection\sql_error(), and DatabaseConnection\sql_fetch_assoc().

admin_query (   $query)

mysqli() wrapper function, used by the Install Tool and EM for all queries regarding management of the database!

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

Definition at line 2987 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\$lastHandlerKey, DatabaseConnection\clearCachedFieldInfo(), DatabaseConnection\exec_INSERTquery(), DatabaseConnection\exec_TRUNCATEquery(), DatabaseConnection\handler_getFromTableList(), DatabaseConnection\map_genericQueryParsed(), and DatabaseConnection\query().

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 dbal/Classes/Database/DatabaseConnection.php.

References GeneralUtility\makeInstance(), and DatabaseConnection\parseAndAnalyzeSql().

Referenced by DatabaseConnection\cacheFieldInfo().

analyzeExtensionTables ( )
protected

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

Returns
void

Definition at line 328 of file dbal/Classes/Database/DatabaseConnection.php.

References $GLOBALS, and DatabaseConnection\parseAndAnalyzeSql().

Referenced by DatabaseConnection\cacheFieldInfo().

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 dbal/Classes/Database/DatabaseConnection.php.

Referenced by DatabaseConnection\parseAndAnalyzeSql().

cacheFieldInfo ( )
clearCachedFieldInfo ( )

Clears the cached field information file.

Returns
void

Definition at line 281 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\getFieldInfoCache().

Referenced by DatabaseConnection\admin_query().

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 dbal/Classes/Database/DatabaseConnection.php.

Referenced by DatabaseConnection\exec_SELECTquery(), and DatabaseConnection\SELECTqueryFromArray().

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 4009 of file dbal/Classes/Database/DatabaseConnection.php.

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 3977 of file dbal/Classes/Database/DatabaseConnection.php.

References $GLOBALS.

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 3954 of file dbal/Classes/Database/DatabaseConnection.php.

References $GLOBALS.

debugHandler (   $function,
  $execTime,
  $inData 
)

Debug handler for query execution

Parameters
string$functionFunction name from which this function is called.
string$execTimeExecution time in ms of the query
array$inDataIn-data of various kinds.
Returns
void private

Definition at line 3859 of file dbal/Classes/Database/DatabaseConnection.php.

Referenced by DatabaseConnection\exec_DELETEquery(), DatabaseConnection\exec_INSERTquery(), DatabaseConnection\exec_SELECTquery(), DatabaseConnection\exec_TRUNCATEquery(), DatabaseConnection\exec_UPDATEquery(), and DatabaseConnection\prepare_SELECTquery().

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
\InvalidArgumentException

Definition at line 1218 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\quoteFromTables(), and DatabaseConnection\quoteWhereClause().

Referenced by DatabaseConnection\exec_DELETEquery().

determineHandlerType (   $res)
protected

Determine handler type by result set

Parameters
bool | \mysqli_result | object$resMySQLi result set / DBAL Object
Returns
bool|string

Definition at line 2434 of file dbal/Classes/Database/DatabaseConnection.php.

References elseif.

Referenced by DatabaseConnection\sql_data_seek(), DatabaseConnection\sql_fetch_assoc(), DatabaseConnection\sql_fetch_row(), DatabaseConnection\sql_field_type(), DatabaseConnection\sql_free_result(), and DatabaseConnection\sql_num_rows().

exec_DELETEquery (   $table,
  $where 
)

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

Parameters
string$tableDatabase tablename
string$whereWHERE clause, eg. "uid=1". NOTICE: You must escape values in this argument with $this->fullQuoteStr() yourself!
Returns
bool||object MySQLi result object / DBAL object

Definition at line 733 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\$lastHandlerKey, DatabaseConnection\debug(), DatabaseConnection\debugHandler(), DatabaseConnection\DELETEquery(), DatabaseConnection\handler_getFromTableList(), DatabaseConnection\map_needMapping(), DatabaseConnection\map_sqlParts(), GeneralUtility\milliseconds(), DatabaseConnection\query(), and DatabaseConnection\sql_error().

Referenced by DatabaseConnection\exec_query().

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 dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\exec_INSERTquery(), DatabaseConnection\handler_getFromTableList(), and DatabaseConnection\query().

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
\RuntimeExceptionCreates 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

Definition at line 485 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\$lastHandlerKey, DatabaseConnection\debug(), DatabaseConnection\debugHandler(), elseif, DatabaseConnection\fullQuoteStr(), DatabaseConnection\handler_getFromTableList(), DatabaseConnection\INSERTquery(), DatabaseConnection\map_assocArray(), DatabaseConnection\map_needMapping(), GeneralUtility\milliseconds(), DatabaseConnection\query(), DatabaseConnection\quoteFromTables(), DatabaseConnection\quoteWhereClause(), DatabaseConnection\sql_error(), DatabaseConnection\sql_insert_id(), and DatabaseConnection\updateLastInsertId().

Referenced by DatabaseConnection\admin_query(), DatabaseConnection\exec_INSERTmultipleRows(), and DatabaseConnection\exec_query().

exec_query ( array  $queryParts)
protected

Executes a query. EXPERIMENTAL since TYPO3 4.4.

Parameters
array$queryPartsSQL parsed by method parseSQL() of
Returns
|object MySQLi result object / DBAL object
See Also
self::sql_query()

Definition at line 948 of file dbal/Classes/Database/DatabaseConnection.php.

References $GLOBALS, DatabaseConnection\exec_DELETEquery(), DatabaseConnection\exec_INSERTquery(), DatabaseConnection\exec_SELECTquery(), DatabaseConnection\exec_TRUNCATEquery(), and DatabaseConnection\exec_UPDATEquery().

Referenced by DatabaseConnection\sql_query().

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
\RuntimeException
Returns
bool||object MySQLi result object / DBAL object

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
bool||object MySQLi result object / DBAL object

Definition at line 795 of file dbal/Classes/Database/DatabaseConnection.php.

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

Referenced by DatabaseConnection\exec_query().

exec_TRUNCATEquery (   $table)
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 dbal/Classes/Database/DatabaseConnection.php.

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

Referenced by DatabaseConnection\exec_query().

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 1949 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\quoteStr().

Referenced by DatabaseConnection\exec_INSERTquery(), DatabaseConnection\exec_UPDATEquery(), DatabaseConnection\INSERTquery(), and DatabaseConnection\UPDATEquery().

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 dbal/Classes/Database/DatabaseConnection.php.

Referenced by DatabaseConnection\cacheFieldInfo().

getCompleteFieldInformation ( )
protected

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

Returns
array

Definition at line 360 of file dbal/Classes/Database/DatabaseConnection.php.

Referenced by DatabaseConnection\cacheFieldInfo().

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 2160 of file dbal/Classes/Database/DatabaseConnection.php.

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 2136 of file dbal/Classes/Database/DatabaseConnection.php.

getFieldInfoCache ( )
protected
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 3514 of file dbal/Classes/Database/DatabaseConnection.php.

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 3499 of file dbal/Classes/Database/DatabaseConnection.php.

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
\RuntimeException
Returns
string Meta type (currently ADOdb syntax only, http://phplens.com/lens/adodb/docs-adodb.htm#metatype)

Definition at line 2048 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\$lastHandlerKey, DatabaseConnection\handler_getFromTableList(), and DatabaseConnection\quoteFromTables().

Referenced by DatabaseConnection\MetaType().

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
\InvalidArgumentException
Returns
array

Definition at line 1457 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\handler_getFromTableList(), GeneralUtility\intExplode(), and DatabaseConnection\runningADOdbDriver().

Referenced by DatabaseConnection\prepare_SELECTquery().

getServerVersion ( )

Get the SQL server version

Returns
string

Definition at line 3287 of file dbal/Classes/Database/DatabaseConnection.php.

getSpecifics ( )

Gets the DBMS specifics object

Returns
Specifics

Definition at line 263 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\$dbmsSpecifics.

handler_getFromTableList (   $tableList)

Return the handler key pointing to an appropriate database handler as found in $this->handlerCfg array Notice: TWO or more tables in the table list MUST use the SAME handler key - otherwise a fatal error is thrown! (Logically, no database can possibly join two tables from separate sources!)

Parameters
string$tableListTable list, eg. "pages" or "pages, tt_content" or "pages AS A, tt_content AS B
Exceptions
\RuntimeException
Returns
string Handler key (see $this->handlerCfg array) for table

Definition at line 3067 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\handler_init().

Referenced by DatabaseConnection\admin_query(), DatabaseConnection\exec_DELETEquery(), DatabaseConnection\exec_INSERTmultipleRows(), DatabaseConnection\exec_INSERTquery(), DatabaseConnection\exec_SELECTquery(), DatabaseConnection\exec_TRUNCATEquery(), DatabaseConnection\exec_UPDATEquery(), DatabaseConnection\getMetadata(), DatabaseConnection\getQueryComponents(), DatabaseConnection\INSERTquery(), DatabaseConnection\precompileSELECTquery(), DatabaseConnection\quoteStr(), DatabaseConnection\SELECTquery(), and DatabaseConnection\UPDATEquery().

handler_init (   $handlerKey)
initialize ( )

Initialize the database connection

Returns
void

Definition at line 225 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\cacheFieldInfo(), DatabaseConnection\debug(), and GeneralUtility\makeInstance().

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 dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\INSERTquery().

INSERTquery (   $table,
  $fields_values,
  $no_quote_fields = false 
)

Creates an INSERT SQL-statement for $table from the array with field/value pairs $fields_values.

Parameters
string$tableSee exec_INSERTquery()
array$fields_valuesSee exec_INSERTquery()
bool | array | string$no_quote_fieldsSee fullQuoteArray()
Returns
string|NULL Full SQL query for INSERT, NULL if $rows is empty

Definition at line 1022 of file dbal/Classes/Database/DatabaseConnection.php.

References elseif, DatabaseConnection\fullQuoteStr(), DatabaseConnection\handler_getFromTableList(), DatabaseConnection\quoteFieldNames(), DatabaseConnection\quoteFromTables(), DatabaseConnection\quoteStr(), DatabaseConnection\runningNative(), and DatabaseConnection\sql_field_metatype().

Referenced by DatabaseConnection\exec_INSERTquery(), and DatabaseConnection\INSERTmultipleRows().

isConnected ( )
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 3368 of file dbal/Classes/Database/DatabaseConnection.php.

Referenced by DatabaseConnection\exec_INSERTquery(), DatabaseConnection\exec_UPDATEquery(), and DatabaseConnection\sql_fetch_assoc().

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 3788 of file dbal/Classes/Database/DatabaseConnection.php.

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
\InvalidArgumentException
Returns
void
See Also
::parseSQL()

Definition at line 3728 of file dbal/Classes/Database/DatabaseConnection.php.

Referenced by DatabaseConnection\admin_query().

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 3318 of file dbal/Classes/Database/DatabaseConnection.php.

References elseif.

Referenced by DatabaseConnection\exec_DELETEquery(), DatabaseConnection\exec_INSERTquery(), DatabaseConnection\exec_SELECTquery(), DatabaseConnection\exec_TRUNCATEquery(), DatabaseConnection\exec_UPDATEquery(), DatabaseConnection\prepare_SELECTquery(), and DatabaseConnection\sql_fetch_assoc().

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 3411 of file dbal/Classes/Database/DatabaseConnection.php.

Referenced by DatabaseConnection\exec_SELECTquery(), and DatabaseConnection\prepare_SELECTquery().

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 3530 of file dbal/Classes/Database/DatabaseConnection.php.

References elseif.

Referenced by DatabaseConnection\exec_DELETEquery(), and DatabaseConnection\exec_UPDATEquery().

map_subquery ( $parsedQuery)
protected

Maps table and field names in a subquery.

Parameters
array$parsedQuery
Returns
void

Definition at line 3689 of file dbal/Classes/Database/DatabaseConnection.php.

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 dbal/Classes/Database/DatabaseConnection.php.

References $GLOBALS.

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
\RuntimeException
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, use getMetadata() instead

Definition at line 2032 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\getMetadata(), and GeneralUtility\logDeprecatedFunction().

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 2093 of file dbal/Classes/Database/DatabaseConnection.php.

References GeneralUtility\logDeprecatedFunction().

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 2080 of file dbal/Classes/Database/DatabaseConnection.php.

References GeneralUtility\logDeprecatedFunction().

parseAndAnalyzeSql (   $sql)
protected

Parse and analyze given SQL string

Parameters
$sql
Returns
void

Definition at line 348 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\analyzeFields().

Referenced by DatabaseConnection\analyzeCachingTables(), and DatabaseConnection\analyzeExtensionTables().

precompileSELECTquery ( array  $components)
protected

Precompiles a SELECT prepared SQL statement.

Parameters
array$components
Returns
array Precompiled SQL statement

Definition at line 1503 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\handler_getFromTableList().

Referenced by DatabaseConnection\prepare_SELECTquery().

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 1365 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\_quoteFieldNames(), DatabaseConnection\_quoteFromTables(), DatabaseConnection\_quoteGroupBy(), DatabaseConnection\_quoteOrderBy(), DatabaseConnection\_quoteWhereClause(), DatabaseConnection\debug(), DatabaseConnection\debugHandler(), GeneralUtility\devLog(), DatabaseConnection\getQueryComponents(), GeneralUtility\makeInstance(), DatabaseConnection\map_needMapping(), DatabaseConnection\map_remapSELECTQueryParts(), GeneralUtility\milliseconds(), DatabaseConnection\precompileSELECTquery(), and DatabaseConnection\runningNative().

query (   $query)
protected
quoteFieldNames (   $select_fields)

Quotes field (and table) names with the quote character suitable for the DB being used

Parameters
string$select_fieldsList of fields to be used in query to DB
Exceptions
\InvalidArgumentException
Returns
string Quoted list of fields to be in query to DB

Definition at line 1632 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\_quoteFieldNames(), and DatabaseConnection\runningNative().

Referenced by DatabaseConnection\_quoteFieldNames(), DatabaseConnection\_quoteWhereClause(), DatabaseConnection\INSERTquery(), DatabaseConnection\SELECTquery(), and DatabaseConnection\UPDATEquery().

quoteFromTables (   $from_table)

Quotes table names with the quote character suitable for the DB being used

Parameters
string$from_tableList of tables to be selected from DB
Returns
string Quoted list of tables to be selected from DB

Definition at line 1692 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\_quoteFromTables(), and DatabaseConnection\runningNative().

Referenced by DatabaseConnection\DELETEquery(), DatabaseConnection\exec_INSERTquery(), DatabaseConnection\exec_UPDATEquery(), DatabaseConnection\getMetadata(), DatabaseConnection\INSERTquery(), DatabaseConnection\SELECTquery(), DatabaseConnection\TRUNCATEquery(), and DatabaseConnection\UPDATEquery().

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 1863 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\_quoteGroupBy(), and DatabaseConnection\runningNative().

Referenced by DatabaseConnection\SELECTquery().

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 2006 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\$lastHandlerKey.

Referenced by DatabaseConnection\_quoteFieldNames(), DatabaseConnection\_quoteFromTables(), DatabaseConnection\_quoteGroupBy(), DatabaseConnection\_quoteOrderBy(), and DatabaseConnection\_quoteWhereClause().

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 1901 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\_quoteOrderBy(), and DatabaseConnection\runningNative().

Referenced by DatabaseConnection\SELECTquery().

quoteSELECTsubquery ( array  $components)
protected

Quotes components of a SELECT subquery.

Parameters
array$componentsArray of SQL query components
Returns
array

Definition at line 1617 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\_quoteFieldNames(), DatabaseConnection\_quoteFromTables(), and DatabaseConnection\_quoteWhereClause().

Referenced by DatabaseConnection\_quoteWhereClause().

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
\RuntimeException
Returns
string Output string; Quotes (" / ') and \ will be backslashed (or otherwise based on DBAL handler)
See Also
quoteStr()

Definition at line 1968 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\$lastHandlerKey, DatabaseConnection\connectDB(), DatabaseConnection\handler_getFromTableList(), and DatabaseConnection\isConnected().

Referenced by DatabaseConnection\fullQuoteStr(), DatabaseConnection\INSERTquery(), and DatabaseConnection\UPDATEquery().

quoteWhereClause (   $where_clause)

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

Parameters
string$where_clauseA where clause that can be parsed by parseWhereClause
Exceptions
\InvalidArgumentException
Returns
string Usable where clause with quoted field/table names

Definition at line 1742 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\_quoteWhereClause(), and DatabaseConnection\runningNative().

Referenced by DatabaseConnection\DELETEquery(), DatabaseConnection\exec_INSERTquery(), DatabaseConnection\exec_UPDATEquery(), DatabaseConnection\SELECTquery(), and DatabaseConnection\UPDATEquery().

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 3277 of file dbal/Classes/Database/DatabaseConnection.php.

Referenced by DatabaseConnection\_quoteWhereClause(), DatabaseConnection\getQueryComponents(), DatabaseConnection\SELECTquery(), DatabaseConnection\sql_fetch_assoc(), and DatabaseConnection\sql_fetch_row().

runningNative ( )

Checks whether the DBAL is currently inside an operation running on the "native" DB handler (i.e. MySQL)

Returns
bool TRUE if running on "native" DB handler (i.e. MySQL)

Definition at line 3266 of file dbal/Classes/Database/DatabaseConnection.php.

Referenced by DatabaseConnection\INSERTquery(), DatabaseConnection\prepare_SELECTquery(), DatabaseConnection\quoteFieldNames(), DatabaseConnection\quoteFromTables(), DatabaseConnection\quoteGroupBy(), DatabaseConnection\quoteOrderBy(), DatabaseConnection\quoteWhereClause(), and DatabaseConnection\UPDATEquery().

SELECTquery (   $select_fields,
  $from_table,
  $where_clause,
  $groupBy = '',
  $orderBy = '',
  $limit = '' 
)
SELECTqueryFromArray ( array  $params)
protected

Creates a SELECT SQL-statement to be used with an ADOdb backend.

Parameters
array$paramsparsed parameters: array($select_fields, $from_table, $where_clause, $groupBy, $orderBy)
Returns
string Full SQL query for SELECT

Definition at line 1282 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\_quoteFieldNames(), DatabaseConnection\_quoteFromTables(), DatabaseConnection\_quoteGroupBy(), DatabaseConnection\_quoteOrderBy(), DatabaseConnection\_quoteWhereClause(), and DatabaseConnection\compileSelectParameters().

Referenced by DatabaseConnection\exec_SELECTquery().

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 2473 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\$lastHandlerKey.

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 2497 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\determineHandlerType().

sql_errno ( )

Returns the error number on the last query() execution

Returns
int MySQLi error number

Definition at line 2226 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\$lastHandlerKey.

sql_error ( )
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|boolean Associative array of result row.

Definition at line 2277 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\determineHandlerType(), DatabaseConnection\map_assocArray(), DatabaseConnection\map_needMapping(), and DatabaseConnection\runningADOdbDriver().

Referenced by DatabaseConnection\admin_get_tables().

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|boolean Array with result rows.

Definition at line 2347 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\determineHandlerType(), and DatabaseConnection\runningADOdbDriver().

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 2523 of file dbal/Classes/Database/DatabaseConnection.php.

Referenced by DatabaseConnection\INSERTquery(), and DatabaseConnection\UPDATEquery().

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 2547 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\debug(), DatabaseConnection\determineHandlerType(), and elseif.

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 2402 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\determineHandlerType().

sql_insert_id ( )

Get the ID generated from the previous INSERT operation

Returns
int The uid of the last inserted record.

Definition at line 2451 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\$lastHandlerKey.

Referenced by DatabaseConnection\exec_INSERTquery().

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 2249 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\determineHandlerType().

Referenced by DatabaseConnection\exec_SELECTquery().

sql_pconnect ( )

Open a (persistent) connection to a MySQL server

Returns
bool|void

Definition at line 2644 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\handler_init().

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 2604 of file dbal/Classes/Database/DatabaseConnection.php.

References $GLOBALS, DatabaseConnection\connectDB(), DatabaseConnection\debug(), DatabaseConnection\exec_query(), GeneralUtility\inList(), DatabaseConnection\isConnected(), and DatabaseConnection\sql_error().

sql_select_db ( )

Select a SQL database

Returns
bool Returns TRUE on success or FALSE on failure.

Definition at line 2654 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\$databaseName, DatabaseConnection\$lastHandlerKey, DatabaseConnection\sql_error(), and GeneralUtility\SYSLOG_SEVERITY_FATAL.

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 dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\quoteFromTables().

Referenced by DatabaseConnection\exec_TRUNCATEquery().

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 2106 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\$lastHandlerKey, and elseif.

Referenced by DatabaseConnection\exec_INSERTquery().

UPDATEquery (   $table,
  $where,
  $fields_values,
  $no_quote_fields = false 
)

Creates an UPDATE SQL-statement for $table where $where-clause (typ. 'uid=...') from the array with field/value pairs $fields_values.

Parameters
string$tableSee exec_UPDATEquery()
string$whereSee exec_UPDATEquery()
array$fields_valuesSee exec_UPDATEquery()
bool | array | string$no_quote_fieldsSee fullQuoteArray()
Exceptions
\InvalidArgumentException
Returns
string Full SQL query for UPDATE

Definition at line 1137 of file dbal/Classes/Database/DatabaseConnection.php.

References DatabaseConnection\$store_lastBuiltQuery, elseif, DatabaseConnection\fullQuoteStr(), DatabaseConnection\handler_getFromTableList(), DatabaseConnection\quoteFieldNames(), DatabaseConnection\quoteFromTables(), DatabaseConnection\quoteStr(), DatabaseConnection\quoteWhereClause(), DatabaseConnection\runningNative(), and DatabaseConnection\sql_field_metatype().

Referenced by DatabaseConnection\exec_UPDATEquery().

Member Data Documentation

$cache_autoIncFields = array()
$cache_fieldType = array()
$cache_handlerKeyFromTableList = array()
protected
$cache_mappingFromTableList = array()
protected
$cache_primaryKeys = array()
$cacheIdentifier = 'DatabaseConnection_fieldInfo'
protected
$conf = array()

Definition at line 39 of file dbal/Classes/Database/DatabaseConnection.php.

$dbmsSpecifics
protected
$debug = false

Definition at line 33 of file dbal/Classes/Database/DatabaseConnection.php.

$handlerCfg
Initial value:
= array(
'_DEFAULT' => array(
'type' => 'native',
'config' => array(
'username' => '',
'password' => '',
'host' => '',
'database' => '',
'driver' => '',
'sequenceStart' => 1,
'useNameQuote' => 0,
'quoteClob' => false
)
)
)

Definition at line 57 of file dbal/Classes/Database/DatabaseConnection.php.

$handlerInstance = array()

Definition at line 89 of file dbal/Classes/Database/DatabaseConnection.php.

$installerSql = null
protected
$lastHandlerKey = ''
$lastParsedAndMappedQueryArray = array()
protected
$lastQuery = ''
protected
$mapping = array()

Definition at line 45 of file dbal/Classes/Database/DatabaseConnection.php.

$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 171 of file dbal/Classes/Database/DatabaseConnection.php.

$printErrors = false
protected

Definition at line 27 of file dbal/Classes/Database/DatabaseConnection.php.

$queryCache
protected
$resourceIdToTableNameMap = array()
protected
$SQLparser
$table2handlerKeys = array()
protected

Definition at line 51 of file dbal/Classes/Database/DatabaseConnection.php.