TYPO3
7.6
|
Public Member Functions | |
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 | |
const | AND_Constraint = 'AND' |
const | OR_Constraint = 'OR' |
$debugOutput = false | |
$debug_lastBuiltQuery = '' | |
$store_lastBuiltQuery = false | |
$explainOutput = 0 | |
$default_charset = 'utf8' | |
Protected Member Functions | |
query ($query) | |
getSelectMmQueryParts ($select, $local_table, $mm_table, $foreign_table, $whereClause= '', $groupBy= '', $orderBy= '', $limit= '') | |
checkConnectionCharset () | |
disconnectIfConnected () | |
explain ($query, $from_table, $row_count) | |
Protected Attributes | |
$databaseHost = '' | |
$databasePort = 3306 | |
$databaseSocket = null | |
$databaseName = '' | |
$databaseUsername = '' | |
$databaseUserPassword = '' | |
$persistentDatabaseConnection = false | |
$connectionCompression = false | |
$connectionCharset = 'utf8' | |
$initializeCommandsAfterConnect = array() | |
$isConnected = false | |
$link = null | |
$preProcessHookObjects = array() | |
$postProcessHookObjects = array() | |
Static Protected Attributes | |
static | $dateTimeFormats |
Contains the class "DatabaseConnection" containing functions for building SQL queries and mysqli wrappers, thus providing a foundational API to all database interaction. This class is instantiated globally as $TYPO3_DB in TYPO3 scripts.
TYPO3 "database wrapper" class (new in 3.6.0) This class contains
This class is not in itself a complete database abstraction layer but can be extended to be a DBAL (by extensions, see "dbal" for example) ALL connectivity to the database in TYPO3 must be done through this class! The points of this class are:
USE: In all TYPO3 scripts the global variable $TYPO3_DB is an instance of this class. Use that. Eg. $GLOBALS['TYPO3_DB']->sql_fetch_assoc()
Definition at line 45 of file core/Classes/Database/DatabaseConnection.php.
__sleep | ( | ) |
Serialize destructs current connection
Definition at line 1990 of file core/Classes/Database/DatabaseConnection.php.
admin_get_charsets | ( | ) |
Returns information about the character sets supported by the current DBM This function is important not only for the Install Tool but probably for DBALs as well since they might need to look up table specific information in order to construct correct queries. In such cases this information should probably be cached for quick delivery.
This is used by the Install Tool to convert tables with non-UTF8 charsets Use in Install Tool only!
Returns information about the character sets supported by the current DBM This function is important not only for the Install Tool but probably for DBALs as well since they might need to look up table specific information in order to construct correct queries. In such cases this information should probably be cached for quick delivery.
This is used by the Install Tool to convert tables tables with non-UTF8 charsets Use in Install Tool only!
Definition at line 1475 of file core/Classes/Database/DatabaseConnection.php.
admin_get_dbs | ( | ) |
Listing databases from current MySQL connection. NOTICE: It WILL try to select those databases and thus break selection of current database. This is only used as a service function in the (1-2-3 process) of the Install Tool. In any case a lookup should be done in the _DEFAULT handler DBMS then. Use in Install Tool only!
\RuntimeException |
Definition at line 1373 of file core/Classes/Database/DatabaseConnection.php.
admin_get_fields | ( | $tableName | ) |
Returns information about each field in the $table (quering the DBMS) In a DBAL this should look up the right handler for the table and return compatible information This function is important not only for the Install Tool but probably for DBALs as well since they might need to look up table specific information in order to construct correct queries. In such cases this information should probably be cached for quick delivery.
string | $tableName | Table name |
Definition at line 1430 of file core/Classes/Database/DatabaseConnection.php.
admin_get_keys | ( | $tableName | ) |
Returns information about each index key in the $table (quering the DBMS) In a DBAL this should look up the right handler for the table and return compatible information
string | $tableName | Table name |
Definition at line 1450 of file core/Classes/Database/DatabaseConnection.php.
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
Definition at line 1406 of file core/Classes/Database/DatabaseConnection.php.
admin_query | ( | $query | ) |
mysqli() wrapper function, used by the Install Tool and EM for all queries regarding management of the database!
string | $query | Query to execute |
Definition at line 1494 of file core/Classes/Database/DatabaseConnection.php.
References debug().
|
protected |
Checks if the current connection character set has the same value as the connectionCharset variable.
To determine the character set these MySQL session variables are checked: character_set_client, character_set_results and character_set_connection.
If the character set does not match or if the session variables can not be read a RuntimeException is thrown.
\RuntimeException |
Definition at line 1714 of file core/Classes/Database/DatabaseConnection.php.
References $GLOBALS, and GeneralUtility\SYSLOG_SEVERITY_ERROR.
Referenced by DatabaseConnection\handler_init().
cleanIntArray | ( | $arr | ) |
Will convert all values in the one-dimensional array to integers. Useful when you want to make sure an array contains only integers before imploding them in a select-list.
array | $arr | Array with values |
Definition at line 933 of file core/Classes/Database/DatabaseConnection.php.
cleanIntList | ( | $list | ) |
Will force all entries in the input comma list to integers Useful when you want to make sure a commalist of supposed integers really contain only integers; You want to know that when you don't trust content that could go into an SQL statement.
string | $list | List of comma-separated values which should be integers |
Definition at line 946 of file core/Classes/Database/DatabaseConnection.php.
References $list, and GeneralUtility\intExplode().
connectDB | ( | ) |
Connects to database for TYPO3 sites:
\RuntimeException | |
\UnexpectedValueException |
Definition at line 1631 of file core/Classes/Database/DatabaseConnection.php.
References $GLOBALS, and GeneralUtility\getUserObj().
Referenced by DatabaseConnection\query(), DatabaseConnection\quoteStr(), and DatabaseConnection\sql_query().
debug | ( | $func, | |
$query = '' |
|||
) |
Debug function: Outputs error if any
string | $func | Function calling debug() |
string | $query | Last query if not last built query |
Definition at line 1832 of file core/Classes/Database/DatabaseConnection.php.
References $GLOBALS, and debug().
Referenced by DatabaseConnection\exec_DELETEquery(), DatabaseConnection\exec_INSERTquery(), DatabaseConnection\exec_SELECTquery(), DatabaseConnection\exec_TRUNCATEquery(), DatabaseConnection\exec_UPDATEquery(), DatabaseConnection\initialize(), DatabaseConnection\prepare_SELECTquery(), DatabaseConnection\sql_field_type(), and DatabaseConnection\sql_query().
debug_check_recordset | ( | $res | ) |
Checks if record set is valid and writes debugging information into devLog if not.
bool|\mysqli_result|object | MySQLi result object / DBAL object |
Definition at line 1857 of file core/Classes/Database/DatabaseConnection.php.
References GeneralUtility\devLog(), and GeneralUtility\SYSLOG_SEVERITY_ERROR.
|
protected |
Disconnect from database if connected
Definition at line 1782 of file core/Classes/Database/DatabaseConnection.php.
escapeStrForLike | ( | $str, | |
$table | |||
) |
Escaping values for SQL LIKE statements.
string | $str | Input string |
string | $table | Table name for which to escape 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!). |
Definition at line 920 of file core/Classes/Database/DatabaseConnection.php.
Referenced by DatabaseConnection\_quoteWhereClause().
exec_SELECT_mm_query | ( | $select, | |
$local_table, | |||
$mm_table, | |||
$foreign_table, | |||
$whereClause = '' , |
|||
$groupBy = '' , |
|||
$orderBy = '' , |
|||
$limit = '' |
|||
) |
Creates and executes a SELECT query, selecting fields ($select) from two/three tables joined Use $mm_table together with $local_table or $foreign_table to select over two tables. Or use all three tables to select the full MM-relation. The JOIN is done with [$local_table].uid <–> [$mm_table].uid_local / [$mm_table].uid_foreign <–> [$foreign_table].uid The function is very useful for selecting MM-relations between tables adhering to the MM-format used by TCE (TYPO3 Core Engine). See the section on $GLOBALS['TCA'] in Inside TYPO3 for more details.
string | $select | Field list for SELECT |
string | $local_table | Tablename, local table |
string | $mm_table | Tablename, relation table |
string | $foreign_table | Tablename, foreign table |
string | $whereClause | Optional additional 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! You have to prepend 'AND ' to this parameter yourself! |
string | $groupBy | Optional GROUP BY field(s), if none, supply blank string. |
string | $orderBy | Optional ORDER BY field(s), if none, supply blank string. |
string | $limit | Optional LIMIT value ([begin,]max), if none, supply blank string. |
Definition at line 343 of file core/Classes/Database/DatabaseConnection.php.
References DatabaseConnection\exec_SELECT_queryArray(), and DatabaseConnection\getSelectMmQueryParts().
exec_SELECT_queryArray | ( | $queryParts | ) |
Executes a select based on input query parts array
array | $queryParts | Query parts array |
Definition at line 356 of file core/Classes/Database/DatabaseConnection.php.
Referenced by DatabaseConnection\exec_SELECT_mm_query().
exec_SELECTcountRows | ( | $field, | |
$table, | |||
$where = '1=1' |
|||
) |
Counts the number of rows in a table.
string | $field | Name of the field to use in the COUNT() expression (e.g. '*') |
string | $table | Name of the table to count rows for |
string | $where | (optional) WHERE statement of the query |
Definition at line 437 of file core/Classes/Database/DatabaseConnection.php.
References DatabaseConnection\sql_fetch_row(), and DatabaseConnection\sql_free_result().
exec_SELECTgetRows | ( | $select_fields, | |
$from_table, | |||
$where_clause, | |||
$groupBy = '' , |
|||
$orderBy = '' , |
|||
$limit = '' , |
|||
$uidIndexField = '' |
|||
) |
Creates and executes a SELECT SQL-statement AND traverse result set and returns array with records in.
string | $select_fields | List of fields to select from the table. This is what comes right after "SELECT ...". Required value. |
string | $from_table | Table(s) from which to select. This is what comes right after "FROM ...". Required value. |
string | $where_clause | Additional 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 | $groupBy | Optional GROUP BY field(s), if none, supply blank string. |
string | $orderBy | Optional ORDER BY field(s), if none, supply blank string. |
string | $limit | Optional LIMIT value ([begin,]max), if none, supply blank string. |
string | $uidIndexField | If set, the result array will carry this field names value as index. Requires that field to be selected of course! |
\InvalidArgumentException |
Definition at line 375 of file core/Classes/Database/DatabaseConnection.php.
References DatabaseConnection\sql_error(), DatabaseConnection\sql_fetch_assoc(), and DatabaseConnection\sql_free_result().
exec_SELECTgetSingleRow | ( | $select_fields, | |
$from_table, | |||
$where_clause, | |||
$groupBy = '' , |
|||
$orderBy = '' , |
|||
$numIndex = false |
|||
) |
Creates and executes a SELECT SQL-statement AND gets a result set and returns an array with a single record in. LIMIT is automatically set to 1 and can not be overridden.
string | $select_fields | List of fields to select from the table. |
string | $from_table | Table(s) from which to select. |
string | $where_clause | Optional additional WHERE clauses put in the end of the query. NOTICE: You must escape values in this argument with $this->fullQuoteStr() yourself! |
string | $groupBy | Optional GROUP BY field(s), if none, supply blank string. |
string | $orderBy | Optional ORDER BY field(s), if none, supply blank string. |
bool | $numIndex | If set, the result will be fetched with sql_fetch_row, otherwise sql_fetch_assoc will be used. |
Definition at line 414 of file core/Classes/Database/DatabaseConnection.php.
References DatabaseConnection\sql_fetch_assoc(), DatabaseConnection\sql_fetch_row(), and DatabaseConnection\sql_free_result().
|
protected |
Explain select queries If $this->explainOutput is set, SELECT queries will be explained here. Only queries with more than one possible result row will be displayed. The output is either printed as raw HTML output or embedded into the TS admin panel (checkbox must be enabled!)
string | $query | SQL query |
string | $from_table | Table(s) from which to select. This is what comes right after "FROM ...". Required value. |
int | $row_count | Number of resulting rows |
Definition at line 1904 of file core/Classes/Database/DatabaseConnection.php.
References $GLOBALS, GeneralUtility\cmpIP(), debug(), elseif, GeneralUtility\getIndpEnv(), and GeneralUtility\inList().
fullQuoteArray | ( | $arr, | |
$table, | |||
$noQuote = false , |
|||
$allowNull = false |
|||
) |
Will fullquote all values in the one-dimensional array so they are ready to "implode" for an sql query.
array | $arr | Array with values (either associative or non-associative array) |
string | $table | Table name for which to quote |
bool | array | $noQuote | List/array of keys NOT to quote (eg. SQL functions) - ONLY for associative arrays |
bool | $allowNull | Whether to allow NULL values |
Definition at line 879 of file core/Classes/Database/DatabaseConnection.php.
References elseif.
Referenced by DatabaseConnection\INSERTquery().
fullQuoteStr | ( | $str, | |
$table, | |||
$allowNull = false |
|||
) |
Escaping and quoting values for SQL statements.
string | $str | Input string |
string | $table | Table 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 | $allowNull | Whether to allow NULL values |
Definition at line 854 of file core/Classes/Database/DatabaseConnection.php.
getDatabaseHandle | ( | ) |
Returns current database handle
Definition at line 1795 of file core/Classes/Database/DatabaseConnection.php.
getDateTimeFormats | ( | $table | ) |
Returns the date and time formats compatible with the given database table.
string | $table | Table name for which to return an empty date. Just enter the table that the field-value is selected from (and any DBAL will look up which handler to use and then how date and time should be formatted). |
Definition at line 1029 of file core/Classes/Database/DatabaseConnection.php.
|
protected |
Creates SELECT query components for selecting fields ($select) from two/three tables joined Use $mm_table together with $local_table or $foreign_table to select over two tables. Or use all three tables to select the full MM-relation. The JOIN is done with [$local_table].uid <–> [$mm_table].uid_local / [$mm_table].uid_foreign <–> [$foreign_table].uid The function is very useful for selecting MM-relations between tables adhering to the MM-format used by TCE (TYPO3 Core Engine). See the section on $GLOBALS['TCA'] in Inside TYPO3 for more details.
string | $select | See exec_SELECT_mm_query() |
string | $local_table | See exec_SELECT_mm_query() |
string | $mm_table | See exec_SELECT_mm_query() |
string | $foreign_table | See exec_SELECT_mm_query() |
string | $whereClause | See exec_SELECT_mm_query() |
string | $groupBy | See exec_SELECT_mm_query() |
string | $orderBy | See exec_SELECT_mm_query() |
string | $limit | See exec_SELECT_mm_query() |
Definition at line 1050 of file core/Classes/Database/DatabaseConnection.php.
References StringUtility\getUniqueId().
Referenced by DatabaseConnection\exec_SELECT_mm_query(), and DatabaseConnection\SELECT_mm_query().
getServerVersion | ( | ) |
Get the MySQL server version
Definition at line 1815 of file core/Classes/Database/DatabaseConnection.php.
initialize | ( | ) |
Initialize the database connection
Definition at line 192 of file core/Classes/Database/DatabaseConnection.php.
INSERTquery | ( | $table, | |
$fields_values, | |||
$no_quote_fields = false |
|||
) |
Creates an INSERT SQL-statement for $table from the array with field/value pairs $fields_values.
string | $table | See exec_INSERTquery() |
array | $fields_values | See exec_INSERTquery() |
bool | array | string | $no_quote_fields | See fullQuoteArray() |
Definition at line 496 of file core/Classes/Database/DatabaseConnection.php.
References DatabaseConnection\fullQuoteArray().
isConnected | ( | ) |
Checks if database is connected
Definition at line 1689 of file core/Classes/Database/DatabaseConnection.php.
Referenced by DatabaseConnection\query().
listQuery | ( | $field, | |
$value, | |||
$table | |||
) |
Returns a WHERE clause that can find a value ($value) in a list field ($field) For instance a record in the database might contain a list of numbers, "34,234,5" (with no spaces between). This query would be able to select that record based on the value "34", "234" or "5" regardless of their position in the list (left, middle or right). The value must not contain a comma (,) Is nice to look up list-relations to records or files in TYPO3 database tables.
string | $field | Field name |
string | $value | Value to find in list |
string | $table | Table in which we are searching (for DBAL detection of quoteStr() method) |
\InvalidArgumentException |
Definition at line 732 of file core/Classes/Database/DatabaseConnection.php.
References DatabaseConnection\quoteStr().
prepare_PREPAREDquery | ( | $query, | |
array | $queryComponents | ||
) |
Prepares a prepared query.
string | $query | The query to execute |
array | $queryComponents | The components of the query to execute |
Prepares a prepared query.
string | $query | The query to execute |
array | $queryComponents | The components of the query to execute |
\RuntimeException |
Definition at line 822 of file core/Classes/Database/DatabaseConnection.php.
References debug().
prepare_SELECTqueryArray | ( | array | $queryParts, |
array | $input_parameters = array() |
||
) |
Creates a SELECT prepared SQL statement based on input query parts array
array | $queryParts | Query parts array |
array | $input_parameters | An 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. |
Definition at line 809 of file core/Classes/Database/DatabaseConnection.php.
|
protected |
Central query method. Also checks if there is a database connection. Use this to execute database queries instead of directly calling $this->link->query()
string | $query | The query to send to the database |
Definition at line 475 of file core/Classes/Database/DatabaseConnection.php.
References DatabaseConnection\connectDB(), and DatabaseConnection\isConnected().
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()!
string | $str | Input string |
string | $table | Table 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!). |
Definition at line 904 of file core/Classes/Database/DatabaseConnection.php.
Referenced by DatabaseConnection\listQuery().
searchQuery | ( | $searchWords, | |
$fields, | |||
$table, | |||
$constraint = self::AND_Constraint |
|||
) |
Returns a WHERE clause which will make an AND or OR search for the words in the $searchWords array in any of the fields in array $fields.
array | $searchWords | Array of search words |
array | $fields | Array of fields |
string | $table | Table in which we are searching (for DBAL detection of quoteStr() method) |
string | $constraint | How multiple search words have to match ('AND' or 'OR') |
Definition at line 752 of file core/Classes/Database/DatabaseConnection.php.
SELECT_mm_query | ( | $select, | |
$local_table, | |||
$mm_table, | |||
$foreign_table, | |||
$whereClause = '' , |
|||
$groupBy = '' , |
|||
$orderBy = '' , |
|||
$limit = '' |
|||
) |
Creates a SELECT query, selecting fields ($select) from two/three tables joined Use $mm_table together with $local_table or $foreign_table to select over two tables. Or use all three tables to select the full MM-relation. The JOIN is done with [$local_table].uid <–> [$mm_table].uid_local / [$mm_table].uid_foreign <–> [$foreign_table].uid The function is very useful for selecting MM-relations between tables adhering to the MM-format used by TCE (TYPO3 Core Engine). See the section on $GLOBALS['TCA'] in Inside TYPO3 for more details.
string | $select | See exec_SELECT_mm_query() |
string | $local_table | See exec_SELECT_mm_query() |
string | $mm_table | See exec_SELECT_mm_query() |
string | $foreign_table | See exec_SELECT_mm_query() |
string | $whereClause | See exec_SELECT_mm_query() |
string | $groupBy | See exec_SELECT_mm_query() |
string | $orderBy | See exec_SELECT_mm_query() |
string | $limit | See exec_SELECT_mm_query() |
Definition at line 689 of file core/Classes/Database/DatabaseConnection.php.
References DatabaseConnection\getSelectMmQueryParts().
SELECTsubquery | ( | $select_fields, | |
$from_table, | |||
$where_clause | |||
) |
Creates a SELECT SQL-statement to be used as subquery within another query. BEWARE: This method should not be overriden within DBAL to prevent quoting from happening.
string | $select_fields | List of fields to select from the table. |
string | $from_table | Table from which to select. |
string | $where_clause | Conditional WHERE statement |
Definition at line 660 of file core/Classes/Database/DatabaseConnection.php.
setConnectionCharset | ( | $connectionCharset = 'utf8' | ) |
Set the charset that should be used for the MySQL connection. The given value will be passed on to mysqli_set_charset().
The default value of this setting is utf8.
string | $connectionCharset | The connection charset that will be passed on to mysqli_set_charset() when connecting the database. Default is utf8. |
Definition at line 1618 of file core/Classes/Database/DatabaseConnection.php.
setConnectionCompression | ( | $connectionCompression | ) |
Set connection compression. Might be an advantage, if SQL server is not on localhost
bool | $connectionCompression | TRUE if connection should be compressed |
Definition at line 1592 of file core/Classes/Database/DatabaseConnection.php.
setDatabaseHandle | ( | $handle | ) |
Set current database handle, usually
\mysqli | $handle |
Definition at line 1805 of file core/Classes/Database/DatabaseConnection.php.
setDatabaseHost | ( | $host = 'localhost' | ) |
Set database host
string | $host |
Definition at line 1514 of file core/Classes/Database/DatabaseConnection.php.
setDatabaseName | ( | $name | ) |
Set database name
string | $name |
Definition at line 1547 of file core/Classes/Database/DatabaseConnection.php.
setDatabasePassword | ( | $password | ) |
Set database password
string | $password |
Definition at line 1569 of file core/Classes/Database/DatabaseConnection.php.
setDatabasePort | ( | $port = 3306 | ) |
Set database port
int | $port |
Definition at line 1525 of file core/Classes/Database/DatabaseConnection.php.
setDatabaseSocket | ( | $socket = null | ) |
Set database socket
string | NULL | $socket |
Definition at line 1536 of file core/Classes/Database/DatabaseConnection.php.
setDatabaseUsername | ( | $username | ) |
Set database username
string | $username |
Definition at line 1558 of file core/Classes/Database/DatabaseConnection.php.
setInitializeCommandsAfterConnect | ( | array | $commands | ) |
Set commands to be fired after connection was established
array | $commands | List of SQL commands to be executed after connect |
Definition at line 1603 of file core/Classes/Database/DatabaseConnection.php.
setPersistentDatabaseConnection | ( | $persistentDatabaseConnection | ) |
Set persistent database connection
bool | $persistentDatabaseConnection |
Definition at line 1581 of file core/Classes/Database/DatabaseConnection.php.
splitGroupOrderLimit | ( | $str | ) |
Takes the last part of a query, eg. "... uid=123 GROUP BY title ORDER BY title LIMIT 5,2" and splits each part into a table (WHERE, GROUPBY, ORDERBY, LIMIT) Work-around function for use where you know some userdefined end to an SQL clause is supplied and you need to separate these factors.
string | $str | Input string |
Definition at line 987 of file core/Classes/Database/DatabaseConnection.php.
References GeneralUtility\logDeprecatedFunction().
sql_affected_rows | ( | ) |
Returns the number of rows affected by the last INSERT, UPDATE or DELETE query
Definition at line 1204 of file core/Classes/Database/DatabaseConnection.php.
sql_data_seek | ( | $res, | |
$seek | |||
) |
Move internal result pointer
bool | \mysqli_result | object | $res | MySQLi result object / DBAL object |
int | $seek | Seek result number. |
Definition at line 1216 of file core/Classes/Database/DatabaseConnection.php.
sql_errno | ( | ) |
Returns the error number on the last query() execution
Definition at line 1109 of file core/Classes/Database/DatabaseConnection.php.
sql_error | ( | ) |
Returns the error status on the last query() execution
Definition at line 1099 of file core/Classes/Database/DatabaseConnection.php.
Referenced by DatabaseConnection\exec_SELECTgetRows().
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
bool | \mysqli_result | object | $res | MySQLi result object / DBAL object |
Definition at line 1136 of file core/Classes/Database/DatabaseConnection.php.
Referenced by DatabaseConnection\exec_SELECTgetRows(), and DatabaseConnection\exec_SELECTgetSingleRow().
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
bool | \mysqli_result | object | $res | MySQLi result object / DBAL object |
Definition at line 1158 of file core/Classes/Database/DatabaseConnection.php.
Referenced by DatabaseConnection\exec_SELECTcountRows(), and DatabaseConnection\exec_SELECTgetSingleRow().
sql_field_type | ( | $res, | |
$pointer | |||
) |
Get the type of the specified field in a result mysql_field_type() wrapper function
bool | \mysqli_result | object | $res | MySQLi result object / DBAL object |
int | $pointer | Field index. |
Definition at line 1233 of file core/Classes/Database/DatabaseConnection.php.
sql_free_result | ( | $res | ) |
Free result memory free_result() wrapper function
bool | \mysqli_result | object | $res | MySQLi result object / DBAL object |
Definition at line 1179 of file core/Classes/Database/DatabaseConnection.php.
Referenced by DatabaseConnection\exec_SELECTcountRows(), DatabaseConnection\exec_SELECTgetRows(), and DatabaseConnection\exec_SELECTgetSingleRow().
sql_insert_id | ( | ) |
Get the ID generated from the previous INSERT operation
Definition at line 1194 of file core/Classes/Database/DatabaseConnection.php.
sql_num_rows | ( | $res | ) |
Returns the number of selected rows.
bool | \mysqli_result | object | $res | MySQLi result object / DBAL object |
Definition at line 1120 of file core/Classes/Database/DatabaseConnection.php.
sql_pconnect | ( | ) |
Open a (persistent) connection to a MySQL server
\RuntimeException |
Definition at line 1274 of file core/Classes/Database/DatabaseConnection.php.
References GeneralUtility\SYSLOG_SEVERITY_ERROR, and GeneralUtility\SYSLOG_SEVERITY_FATAL.
sql_query | ( | $query | ) |
Executes query 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.
string | $query | Query to execute |
Definition at line 1085 of file core/Classes/Database/DatabaseConnection.php.
References debug().
sql_select_db | ( | ) |
Select a SQL database
Definition at line 1341 of file core/Classes/Database/DatabaseConnection.php.
References GeneralUtility\SYSLOG_SEVERITY_FATAL.
stripGroupBy | ( | $str | ) |
Removes the prefix "GROUP BY" from the input string. This function is used when you call the SELECTquery() function and want to pass the GROUP BY parameter by can't guarantee that "GROUP BY" is not prefixed. Generally; This function provides a work-around to the situation where you cannot pass only the fields by which to order the result.
string | $str | eg. "GROUP BY title, uid @return string eg. "title, uid |
Definition at line 974 of file core/Classes/Database/DatabaseConnection.php.
stripOrderBy | ( | $str | ) |
Removes the prefix "ORDER BY" from the input string. This function is used when you call the exec_SELECTquery() function and want to pass the ORDER BY parameter by can't guarantee that "ORDER BY" is not prefixed. Generally; This function provides a work-around to the situation where you cannot pass only the fields by which to order the result.
string | $str | eg. "ORDER BY title, uid @return string eg. "title, uid |
Definition at line 960 of file core/Classes/Database/DatabaseConnection.php.
|
protected |
Definition at line 137 of file core/Classes/Database/DatabaseConnection.php.
|
protected |
Definition at line 129 of file core/Classes/Database/DatabaseConnection.php.
|
protected |
Definition at line 93 of file core/Classes/Database/DatabaseConnection.php.
Referenced by DatabaseConnection\handler_init().
|
protected |
Definition at line 108 of file core/Classes/Database/DatabaseConnection.php.
Referenced by DatabaseConnection\handler_init(), and DatabaseConnection\sql_select_db().
|
protected |
Definition at line 98 of file core/Classes/Database/DatabaseConnection.php.
|
protected |
Definition at line 103 of file core/Classes/Database/DatabaseConnection.php.
|
protected |
Definition at line 113 of file core/Classes/Database/DatabaseConnection.php.
Referenced by DatabaseConnection\handler_init().
|
protected |
Definition at line 118 of file core/Classes/Database/DatabaseConnection.php.
Referenced by DatabaseConnection\handler_init().
|
staticprotected |
Definition at line 176 of file core/Classes/Database/DatabaseConnection.php.
$debug_lastBuiltQuery = '' |
Definition at line 73 of file core/Classes/Database/DatabaseConnection.php.
$debugOutput = false |
Definition at line 66 of file core/Classes/Database/DatabaseConnection.php.
$default_charset = 'utf8' |
Definition at line 159 of file core/Classes/Database/DatabaseConnection.php.
$explainOutput = 0 |
Definition at line 88 of file core/Classes/Database/DatabaseConnection.php.
|
protected |
Definition at line 142 of file core/Classes/Database/DatabaseConnection.php.
|
protected |
Definition at line 147 of file core/Classes/Database/DatabaseConnection.php.
|
protected |
Definition at line 152 of file core/Classes/Database/DatabaseConnection.php.
Referenced by DatabaseConnection\handler_init().
|
protected |
Definition at line 124 of file core/Classes/Database/DatabaseConnection.php.
|
protected |
Definition at line 169 of file core/Classes/Database/DatabaseConnection.php.
|
protected |
Definition at line 164 of file core/Classes/Database/DatabaseConnection.php.
$store_lastBuiltQuery = false |
Definition at line 80 of file core/Classes/Database/DatabaseConnection.php.
Referenced by DatabaseConnection\UPDATEquery().
const AND_Constraint = 'AND' |
Definition at line 52 of file core/Classes/Database/DatabaseConnection.php.
const OR_Constraint = 'OR' |
Definition at line 59 of file core/Classes/Database/DatabaseConnection.php.