Öffentliche Methoden | |
| init ($config, &$pObj) | |
| resetStatusVars () | |
| processAccordingToConfig (&$value, $fInfo) | |
| exec_INSERTquery ($table, $fields_values) | |
| exec_UPDATEquery ($table, $where, $fields_values) | |
| exec_DELETEquery ($table, $where) | |
| exec_SELECTquery ($select_fields, $from_table, $where_clause, $groupBy, $orderBy, $limit) | |
| sql_query ($query) | |
| sql_error () | |
| sql_insert_id () | |
| sql_affected_rows () | |
| quoteStr ($str) | |
| admin_get_tables () | |
| admin_get_fields ($tableName) | |
| admin_get_keys ($tableName) | |
| admin_query ($query) | |
| readDataSource ($table) | |
| saveDataSource ($table) | |
| selectFromData ($table, $where) | |
| select_evalSingle ($table, $config, &$itemKeys) | |
| getResultSet ($keys, $table, $fieldList) | |
| debug_printResultSet ($array) | |
| parseSQL ($parseString) | |
| parseSELECT ($parseString) | |
| parseUPDATE ($parseString) | |
| parseINSERT ($parseString) | |
| parseDELETE ($parseString) | |
| parseEXPLAIN ($parseString) | |
| parseCREATETABLE ($parseString) | |
| parseALTERTABLE ($parseString) | |
| parseDROPTABLE ($parseString) | |
| parseCREATEDATABASE ($parseString) | |
| parseFieldList (&$parseString, $stopRegex='') | |
| parseFromTables (&$parseString, $stopRegex='') | |
| parseWhereClause (&$parseString, $stopRegex='') | |
| parseFieldDef (&$parseString, $stopRegex='') | |
| nextPart (&$parseString, $regex, $trimAll=FALSE) | |
| getValue (&$parseString, $comparator='') | |
| getValueInQuotes (&$parseString, $quote) | |
| parseStripslashes ($str) | |
| compileAddslashes ($str) | |
| parseError ($msg, $restQuery) | |
| trimSQL ($str) | |
| compileSQL ($components) | |
| compileSELECT ($components) | |
| compileUPDATE ($components) | |
| compileINSERT ($components) | |
| compileDELETE ($components) | |
| compileCREATETABLE ($components) | |
| compileALTERTABLE ($components) | |
| compileFieldList ($selectFields) | |
| compileFromTables ($tablesArray) | |
| compileWhereClause ($clauseArray) | |
| compileFieldCfg ($fieldCfg) | |
| debug_parseSQLpart ($part, $str) | |
| debug_parseSQLpartCompare ($str, $newStr, $caseInsensitive=FALSE) | |
| debug_testSQL ($SQLquery) | |
Öffentliche Attribute | |
| $data = array() | |
| $errorStatus = '' | |
| $lastInsertedId = 0 | |
| $lastAffectedRows = 0 | |
| $parse_error = '' | |
| $lastStopKeyWord = '' | |
| t3lib_sqlengine::admin_get_fields | ( | $ | tableName | ) |
(DUMMY) Returns information about each field in the $table
| string | Table name |
| t3lib_sqlengine::admin_get_keys | ( | $ | tableName | ) |
(DUMMY) Returns information about each index key in the $table
| string | Table name |
| t3lib_sqlengine::admin_get_tables | ( | ) |
(DUMMY) Returns the list of tables from the database
| t3lib_sqlengine::admin_query | ( | $ | query | ) |
(DUMMY) mysql() wrapper function, used by the Install Tool and EM for all queries regarding management of the database!
| string | Query to execute |
| t3lib_sqlparser::compileAddslashes | ( | $ | str | ) | [inherited] |
Add slashes function used for compiling queries NOTICE: If a query being parsed was prepared for another database than MySQL this function should probably be changed
| string | Input string |
| t3lib_sqlparser::compileALTERTABLE | ( | $ | components | ) | [inherited] |
Compiles an ALTER TABLE statement from components array
| array | Array of SQL query components |
| t3lib_sqlparser::compileCREATETABLE | ( | $ | components | ) | [inherited] |
Compiles a CREATE TABLE statement from components array
| array | Array of SQL query components |
| t3lib_sqlparser::compileDELETE | ( | $ | components | ) | [inherited] |
Compiles an DELETE statement from components array
| array | Array of SQL query components |
| t3lib_sqlparser::compileFieldCfg | ( | $ | fieldCfg | ) | [inherited] |
Compile field definition
| array | Field definition parts |
| t3lib_sqlparser::compileFieldList | ( | $ | selectFields | ) | [inherited] |
Compiles a "SELECT [output] FROM..:" field list based on input array (made with ->parseFieldList()) Can also compile field lists for ORDER BY and GROUP BY.
| array | Array of select fields, (made with ->parseFieldList()) |
| t3lib_sqlparser::compileFromTables | ( | $ | tablesArray | ) | [inherited] |
Compiles a "FROM [output] WHERE..:" table list based on input array (made with ->parseFromTables())
| array | Array of table names, (made with ->parseFromTables()) |
| t3lib_sqlparser::compileINSERT | ( | $ | components | ) | [inherited] |
Compiles an INSERT statement from components array
| array | Array of SQL query components |
| t3lib_sqlparser::compileSELECT | ( | $ | components | ) | [inherited] |
Compiles a SELECT statement from components array
| array | Array of SQL query components |
| t3lib_sqlparser::compileSQL | ( | $ | components | ) | [inherited] |
Compiles an SQL query from components
| array | Array of SQL query components |
| t3lib_sqlparser::compileUPDATE | ( | $ | components | ) | [inherited] |
Compiles an UPDATE statement from components array
| array | Array of SQL query components |
| t3lib_sqlparser::compileWhereClause | ( | $ | clauseArray | ) | [inherited] |
Implodes an array of WHERE clause configuration into a WHERE clause. NOTICE: MIGHT BY A TEMPORARY FUNCTION. Use for debugging only! BUT IT IS NEEDED FOR DBAL - MAKE IT PERMANENT?!?!
| array | WHERE clause configuration |
| t3lib_sqlparser::debug_parseSQLpart | ( | $ | part, | |
| $ | str | |||
| ) | [inherited] |
Check parsability of input SQL part string; Will parse and re-compile after which it is compared
| string | Part definition of string; "SELECT" = fieldlist (also ORDER BY and GROUP BY), "FROM" = table list, "WHERE" = Where clause. | |
| string | SQL string to verify parsability of |
| t3lib_sqlparser::debug_parseSQLpartCompare | ( | $ | str, | |
| $ | newStr, | |||
| $ | caseInsensitive = FALSE | |||
| ) | [inherited] |
Compare two query strins by stripping away whitespace.
| string | SQL String 1 | |
| string | SQL string 2 | |
| boolean | If true, the strings are compared insensitive to case |
| t3lib_sqlengine::debug_printResultSet | ( | $ | array | ) |
Returns the result set (in array) as HTML table. For debugging.
| array | Result set array (array of rows) |
| t3lib_sqlparser::debug_testSQL | ( | $ | SQLquery | ) | [inherited] |
Performs the ultimate test of the parser: Direct a SQL query in; You will get it back (through the parsed and re-compiled) if no problems, otherwise the script will print the error and exit
| string | SQL query |
| t3lib_sqlengine::exec_DELETEquery | ( | $ | table, | |
| $ | where | |||
| ) |
Execute DELETE query
| string | Table to delete from | |
| string | WHERE clause |
| t3lib_sqlengine::exec_INSERTquery | ( | $ | table, | |
| $ | fields_values | |||
| ) |
Execute an INSERT query
| string | Table name | |
| array | Field values as key=>value pairs. |
| t3lib_sqlengine::exec_SELECTquery | ( | $ | select_fields, | |
| $ | from_table, | |||
| $ | where_clause, | |||
| $ | groupBy, | |||
| $ | orderBy, | |||
| $ | limit | |||
| ) |
Execute SELECT query
| string | List of fields to select from the table. This is what comes right after "SELECT ...". Required value. | |
| string | Table(s) from which to select. This is what comes right after "FROM ...". Required value. | |
| string | 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! | |
| string | Optional GROUP BY field(s), if none, supply blank string. | |
| string | Optional ORDER BY field(s), if none, supply blank string. | |
| string | Optional LIMIT value ([begin,]max), if none, supply blank string. |
| t3lib_sqlengine::exec_UPDATEquery | ( | $ | table, | |
| $ | where, | |||
| $ | fields_values | |||
| ) |
Execute UPDATE query on table
| string | Table name | |
| string | WHERE clause | |
| array | Field values as key=>value pairs. |
| t3lib_sqlengine::getResultSet | ( | $ | keys, | |
| $ | table, | |||
| $ | fieldList | |||
| ) |
Returning result set based on result keys, table and field list
| array | Result keys | |
| string | Tablename | |
| string | Fieldlist (commaseparated) |
| t3lib_sqlparser::getValue | ( | &$ | parseString, | |
| $ | comparator = '' | |||
| ) | [inherited] |
Finds value in beginning of $parseString, returns result and strips it of parseString
| string | The parseString, eg. "(0,1,2,3) ..." or "('asdf','qwer') ..." or "1234 ..." or "'My string value here' ..." | |
| string | The comparator used before. If "NOT IN" or "IN" then the value is expected to be a list of values. Otherwise just an integer (un-quoted) or string (quoted) |
| t3lib_sqlparser::getValueInQuotes | ( | &$ | parseString, | |
| $ | quote | |||
| ) | [inherited] |
Get value in quotes from $parseString. NOTICE: If a query being parsed was prepared for another database than MySQL this function should probably be changed
| string | String from which to find value in quotes. Notice that $parseString is passed by reference and is shortend by the output of this function. | |
| string | The quote used; input either or ' |
| t3lib_sqlengine::init | ( | $ | config, | |
| &$ | pObj | |||
| ) |
Dummy function for initializing SQL handler. Create you own in derived classes.
| array | Configuration array from handler | |
| object | Parent object |
| t3lib_sqlparser::nextPart | ( | &$ | parseString, | |
| $ | regex, | |||
| $ | trimAll = FALSE | |||
| ) | [inherited] |
Strips off a part of the parseString and returns the matching part. Helper function for the parsing methods.
| string | Parse string; if $regex finds anything the value of the first () level will be stripped of the string in the beginning. Further $parseString is left-trimmed (on success). Notice; parsestring is passed by reference. | |
| string | Regex to find a matching part in the beginning of the string. Rules: You MUST start the regex with "^" (finding stuff in the beginning of string) and the result of the first parenthesis is what will be returned to you (and stripped of the string). Eg. '^(AND|OR|&&)[[:space:]]+' will return AND, OR or && if found and having one of more whitespaces after it, plus shorten $parseString with that match and any space after (by ltrim()) | |
| boolean | If set the full match of the regex is stripped of the beginning of the string! |
| t3lib_sqlparser::parseALTERTABLE | ( | $ | parseString | ) | [inherited] |
Parsing ALTER TABLE query
| string | SQL string starting with ALTER TABLE |
| t3lib_sqlparser::parseCREATEDATABASE | ( | $ | parseString | ) | [inherited] |
Parsing CREATE DATABASE query
| string | SQL string starting with CREATE DATABASE |
| t3lib_sqlparser::parseCREATETABLE | ( | $ | parseString | ) | [inherited] |
Parsing CREATE TABLE query
| string | SQL string starting with CREATE TABLE |
| t3lib_sqlparser::parseDELETE | ( | $ | parseString | ) | [inherited] |
Parsing DELETE query
| string | SQL string with DELETE query to parse |
| t3lib_sqlparser::parseDROPTABLE | ( | $ | parseString | ) | [inherited] |
Parsing DROP TABLE query
| string | SQL string starting with DROP TABLE |
| t3lib_sqlparser::parseError | ( | $ | msg, | |
| $ | restQuery | |||
| ) | [inherited] |
Setting the internal error message value, $this->parse_error and returns that value.
| string | Input error message | |
| string | Remaining query to parse. |
| t3lib_sqlparser::parseEXPLAIN | ( | $ | parseString | ) | [inherited] |
Parsing EXPLAIN query
| string | SQL string with EXPLAIN query to parse |
| t3lib_sqlparser::parseFieldDef | ( | &$ | parseString, | |
| $ | stopRegex = '' | |||
| ) | [inherited] |
Parsing the WHERE clause fields in the "WHERE [$parseString] ..." part of a query into a multidimensional array. The success of this parsing determines if that part of the query is supported by TYPO3.
| string | WHERE clause to parse. NOTICE: passed by reference! | |
| string | Regular expressing to STOP parsing, eg. '^(GROUP BY|ORDER BY|LIMIT)([[:space:]]*)' |
| t3lib_sqlparser::parseFieldList | ( | &$ | parseString, | |
| $ | stopRegex = '' | |||
| ) | [inherited] |
Parsing the fields in the "SELECT [$selectFields] FROM" part of a query into an array. The output from this function can be compiled back into a field list with ->compileFieldList() Will detect the keywords "DESC" and "ASC" after the table name; thus is can be used for parsing the more simply ORDER BY and GROUP BY field lists as well!
| string | The string with fieldnames, eg. "title, uid AS myUid, max(tstamp), count(*)" etc. NOTICE: passed by reference! | |
| string | Regular expressing to STOP parsing, eg. '^(FROM)([[:space:]]*)' |
| t3lib_sqlparser::parseFromTables | ( | &$ | parseString, | |
| $ | stopRegex = '' | |||
| ) | [inherited] |
Parsing the tablenames in the "FROM [$parseString] WHERE" part of a query into an array. The success of this parsing determines if that part of the query is supported by TYPO3.
| string | list of tables, eg. "pages, tt_content" or "pages A, pages B". NOTICE: passed by reference! | |
| string | Regular expressing to STOP parsing, eg. '^(WHERE)([[:space:]]*)' |
| t3lib_sqlparser::parseINSERT | ( | $ | parseString | ) | [inherited] |
Parsing INSERT query
| string | SQL string with INSERT query to parse |
| t3lib_sqlparser::parseSELECT | ( | $ | parseString | ) | [inherited] |
Parsing SELECT query
| string | SQL string with SELECT query to parse |
| t3lib_sqlparser::parseSQL | ( | $ | parseString | ) | [inherited] |
Parses any single SQL query
| string | SQL query |
| t3lib_sqlparser::parseStripslashes | ( | $ | str | ) | [inherited] |
Strip slashes function used for parsing NOTICE: If a query being parsed was prepared for another database than MySQL this function should probably be changed
| string | Input string |
| t3lib_sqlparser::parseUPDATE | ( | $ | parseString | ) | [inherited] |
Parsing UPDATE query
| string | SQL string with UPDATE query to parse |
| t3lib_sqlparser::parseWhereClause | ( | &$ | parseString, | |
| $ | stopRegex = '' | |||
| ) | [inherited] |
Parsing the WHERE clause fields in the "WHERE [$parseString] ..." part of a query into a multidimensional array. The success of this parsing determines if that part of the query is supported by TYPO3.
| string | WHERE clause to parse. NOTICE: passed by reference! | |
| string | Regular expressing to STOP parsing, eg. '^(GROUP BY|ORDER BY|LIMIT)([[:space:]]*)' |
| t3lib_sqlengine::processAccordingToConfig | ( | &$ | value, | |
| $ | fInfo | |||
| ) |
Processing of update/insert values based on field type.
The input value is typecast and trimmed/shortened according to the field type and the configuration options from the $fInfo parameter.
| mixed | $value The input value to process | |
| array | $fInfo Field configuration data |
| t3lib_sqlengine::quoteStr | ( | $ | str | ) |
Quoting strings for insertion in SQL queries
| string | Input String |
| t3lib_sqlengine::readDataSource | ( | $ | table | ) |
Dummy function for setting table data. Create your own. NOTICE: Handler to "table-locking" needs to be made probably!
| string | Table name |
| t3lib_sqlengine::resetStatusVars | ( | ) |
Reset SQL engine status variables (insert id, affected rows, error status)
| t3lib_sqlengine::saveDataSource | ( | $ | table | ) |
Dummy function for setting table data. Create your own. NOTICE: Handler to "table-locking" needs to be made probably!
| string | Table name |
| t3lib_sqlengine::select_evalSingle | ( | $ | table, | |
| $ | config, | |||
| &$ | itemKeys | |||
| ) |
Evalutaion of a WHERE-clause-array. Yet EXPERIMENTAL
| string | Tablename | |
| array | WHERE-configuration array | |
| array | Data array to work on. |
| t3lib_sqlengine::selectFromData | ( | $ | table, | |
| $ | where | |||
| ) |
PHP simulation of SQL "SELECT" Yet EXPERIMENTAL!
| string | Table name | |
| array | Where clause parsed into array |
| t3lib_sqlengine::sql_affected_rows | ( | ) |
Returns affected rows (of UPDATE and DELETE queries)
| t3lib_sqlengine::sql_error | ( | ) |
Returns most recent error
| t3lib_sqlengine::sql_insert_id | ( | ) |
Returns most recently create unique ID (of INSERT queries)
| t3lib_sqlengine::sql_query | ( | $ | query | ) |
Performs an SQL query on the "database"
| string | Query to execute |
| t3lib_sqlparser::trimSQL | ( | $ | str | ) | [inherited] |
Trimming SQL as preparation for parsing. ";" in the end is stripped of. White space is trimmed away around the value A single space-char is added in the end
| string | Input string |
1.6.1