|
TYPO3 API
SVNRelease
|

Public Member Functions | |
| parseSQL ($parseString) | |
| parseFieldList (&$parseString, $stopRegex= '') | |
| parseFromTables (&$parseString, $stopRegex= '') | |
| parseWhereClause (&$parseString, $stopRegex= '', array &$parameterReferences=array()) | |
| parseFieldDef (&$parseString, $stopRegex= '') | |
| compileSQL ($components) | |
| compileFieldList ($selectFields, $compileComments=TRUE) | |
| compileFromTables ($tablesArray) | |
| compileWhereClause ($clauseArray) | |
| compileFieldCfg ($fieldCfg) | |
| debug_parseSQLpart ($part, $str) | |
| debug_parseSQLpartCompare ($str, $newStr, $caseInsensitive=FALSE) | |
| debug_testSQL ($SQLquery) | |
Public Attributes | |
| $parse_error = '' | |
| $lastStopKeyWord = '' | |
Protected Member Functions | |
| parseSELECT ($parseString, &$parameterReferences=NULL) | |
| parseUPDATE ($parseString) | |
| parseINSERT ($parseString) | |
| parseDELETE ($parseString) | |
| parseEXPLAIN ($parseString) | |
| parseCREATETABLE ($parseString) | |
| parseALTERTABLE ($parseString) | |
| parseDROPTABLE ($parseString) | |
| parseCREATEDATABASE ($parseString) | |
| parseTRUNCATETABLE ($parseString) | |
| parseCaseStatement (&$parseString) | |
| nextPart (&$parseString, $regex, $trimAll=FALSE) | |
| & | getValueOrParameter (&$parseString, $comparator= '', $mode= '', array &$parameterReferences=array()) |
| getValue (&$parseString, $comparator= '', $mode= '') | |
| getValueInQuotes (&$parseString, $quote) | |
| parseStripslashes ($str) | |
| compileAddslashes ($str) | |
| parseError ($msg, $restQuery) | |
| trimSQL ($str) | |
| compileSELECT ($components) | |
| compileUPDATE ($components) | |
| compileINSERT ($components) | |
| compileDELETE ($components) | |
| compileCREATETABLE ($components) | |
| compileALTERTABLE ($components) | |
| compileTRUNCATETABLE (array $components) | |
| compileCaseStatement (array $components) | |
Definition at line 101 of file class.t3lib_sqlparser.php.
| t3lib_sqlparser::compileAddslashes | ( | $ | str | ) | [protected] |
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 |
Reimplemented in ux_t3lib_sqlparser.
Definition at line 1596 of file class.t3lib_sqlparser.php.
Referenced by compileFieldCfg(), compileINSERT(), compileUPDATE(), and compileWhereClause().
| t3lib_sqlparser::compileALTERTABLE | ( | $ | components | ) | [protected] |
Compiles an ALTER TABLE statement from components array
| array | Array of SQL query components |
Reimplemented in ux_t3lib_sqlparser.
Definition at line 1839 of file class.t3lib_sqlparser.php.
References $query, and compileFieldCfg().
Referenced by compileSQL().
| t3lib_sqlparser::compileCaseStatement | ( | array $ | components | ) | [protected] |
Compiles a CASE ... WHEN flow-control construct based on input array (made with ->parseCaseStatement())
| array | Array of case components, (made with ->parseCaseStatement()) |
Definition at line 1955 of file class.t3lib_sqlparser.php.
References compileWhereClause().
Referenced by compileFieldList().
| t3lib_sqlparser::compileCREATETABLE | ( | $ | components | ) | [protected] |
Compiles a CREATE TABLE statement from components array
| array | Array of SQL query components |
Reimplemented in ux_t3lib_sqlparser.
Definition at line 1804 of file class.t3lib_sqlparser.php.
References $query, and compileFieldCfg().
Referenced by compileSQL().
| t3lib_sqlparser::compileDELETE | ( | $ | components | ) | [protected] |
Compiles an DELETE statement from components array
| array | Array of SQL query components |
Definition at line 1784 of file class.t3lib_sqlparser.php.
References $query, and compileWhereClause().
Referenced by compileSQL().
| t3lib_sqlparser::compileFieldCfg | ( | $ | fieldCfg | ) |
Compile field definition
| array | Field definition parts |
Reimplemented in ux_t3lib_sqlparser.
Definition at line 2129 of file class.t3lib_sqlparser.php.
References compileAddslashes().
Referenced by compileALTERTABLE(), and compileCREATETABLE().
| t3lib_sqlparser::compileFieldList | ( | $ | selectFields, |
| $ | compileComments = TRUE |
||
| ) |
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()) |
| boolean | Whether comments should be compiled |
Definition at line 1904 of file class.t3lib_sqlparser.php.
References compileCaseStatement().
Referenced by compileSELECT(), and debug_parseSQLpart().
| t3lib_sqlparser::compileFromTables | ( | $ | tablesArray | ) |
Compiles a "FROM [output] WHERE..:" table list based on input array (made with ->parseFromTables())
| array | Array of table names, (made with ->parseFromTables()) |
Definition at line 1983 of file class.t3lib_sqlparser.php.
Referenced by compileSELECT(), and debug_parseSQLpart().
| t3lib_sqlparser::compileINSERT | ( | $ | components | ) | [protected] |
Compiles an INSERT statement from components array
| array | Array of SQL query components |
Reimplemented in ux_t3lib_sqlparser.
Definition at line 1742 of file class.t3lib_sqlparser.php.
References $query, and compileAddslashes().
Referenced by compileSQL().
| t3lib_sqlparser::compileSELECT | ( | $ | components | ) | [protected] |
Compiles a SELECT statement from components array
| array | Array of SQL query components |
Definition at line 1683 of file class.t3lib_sqlparser.php.
References $query, compileFieldList(), compileFromTables(), and compileWhereClause().
Referenced by compileSQL(), ux_t3lib_sqlparser\compileWhereClause(), and compileWhereClause().
| t3lib_sqlparser::compileSQL | ( | $ | components | ) |
Compiles an SQL query from components
| array | Array of SQL query components |
Definition at line 1642 of file class.t3lib_sqlparser.php.
References $query, compileALTERTABLE(), compileCREATETABLE(), compileDELETE(), compileINSERT(), compileSELECT(), compileTRUNCATETABLE(), and compileUPDATE().
Referenced by debug_testSQL().
| t3lib_sqlparser::compileTRUNCATETABLE | ( | array $ | components | ) | [protected] |
Compiles a TRUNCATE TABLE statement from components array
| array | Array of SQL query components |
Definition at line 1879 of file class.t3lib_sqlparser.php.
References $query.
Referenced by compileSQL().
| t3lib_sqlparser::compileUPDATE | ( | $ | components | ) | [protected] |
Compiles an UPDATE statement from components array
| array | Array of SQL query components |
Definition at line 1714 of file class.t3lib_sqlparser.php.
References $query, compileAddslashes(), and compileWhereClause().
Referenced by compileSQL().
| t3lib_sqlparser::compileWhereClause | ( | $ | clauseArray | ) |
Implodes an array of WHERE clause configuration into a WHERE clause.
| array | WHERE clause configuration |
Definition at line 2034 of file class.t3lib_sqlparser.php.
References compileAddslashes(), compileSELECT(), and t3lib_div\inList().
Referenced by compileCaseStatement(), compileDELETE(), compileSELECT(), compileUPDATE(), and debug_parseSQLpart().
| t3lib_sqlparser::debug_parseSQLpart | ( | $ | part, |
| $ | str | ||
| ) |
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 |
Definition at line 2169 of file class.t3lib_sqlparser.php.
References compileFieldList(), compileFromTables(), compileWhereClause(), debug_parseSQLpartCompare(), parseFieldList(), parseFromTables(), and parseWhereClause().
| t3lib_sqlparser::debug_parseSQLpartCompare | ( | $ | str, |
| $ | newStr, | ||
| $ | caseInsensitive = FALSE |
||
| ) |
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 |
Definition at line 2194 of file class.t3lib_sqlparser.php.
References trimSQL().
Referenced by debug_parseSQLpart(), and debug_testSQL().
| t3lib_sqlparser::debug_testSQL | ( | $ | SQLquery | ) |
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 |
Definition at line 2227 of file class.t3lib_sqlparser.php.
References compileSQL(), debug(), debug_parseSQLpartCompare(), and parseSQL().
| t3lib_sqlparser::getValue | ( | &$ | parseString, |
| $ | comparator = '', |
||
| $ | mode = '' |
||
| ) | [protected] |
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) |
| string | The mode, eg. "INDEX" |
Definition at line 1491 of file class.t3lib_sqlparser.php.
References $value, getValueInQuotes(), t3lib_div\inList(), nextPart(), and parseError().
Referenced by getValueOrParameter(), parseALTERTABLE(), parseCaseStatement(), parseCREATETABLE(), parseFieldDef(), parseINSERT(), parseUPDATE(), and parseWhereClause().
| t3lib_sqlparser::getValueInQuotes | ( | &$ | parseString, |
| $ | quote | ||
| ) | [protected] |
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 ' |
Definition at line 1557 of file class.t3lib_sqlparser.php.
References parseStripslashes().
Referenced by getValue().
| & t3lib_sqlparser::getValueOrParameter | ( | &$ | parseString, |
| $ | comparator = '', |
||
| $ | mode = '', |
||
| array &$ | parameterReferences = array() |
||
| ) | [protected] |
Finds value or either named (:name) or question mark (?) parameter markers at the beginning of $parseString, returns result and strips it of parseString. This method returns a pointer to the parameter or value that was found. In case of a parameter the pointer is a reference to the corresponding item in array $parameterReferences.
| string | $parseString | The parseString |
| string | $comparator | The comparator used before. |
| string | $mode | The mode, e.g., "INDEX" |
| mixed | The value (string/integer) or parameter (:name/?). Otherwise an array with error message in first key (0) |
Definition at line 1461 of file class.t3lib_sqlparser.php.
References $value, getValue(), and nextPart().
Referenced by parseWhereClause().
| t3lib_sqlparser::nextPart | ( | &$ | parseString, |
| $ | regex, | ||
| $ | trimAll = FALSE |
||
| ) | [protected] |
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! |
Definition at line 1440 of file class.t3lib_sqlparser.php.
Referenced by getValue(), getValueOrParameter(), parseALTERTABLE(), parseCaseStatement(), parseCREATEDATABASE(), parseCREATETABLE(), parseDELETE(), parseDROPTABLE(), parseFieldDef(), parseFieldList(), parseFromTables(), parseINSERT(), parseSELECT(), parseSQL(), parseTRUNCATETABLE(), parseUPDATE(), and parseWhereClause().
| t3lib_sqlparser::parseALTERTABLE | ( | $ | parseString | ) | [protected] |
Parsing ALTER TABLE query
| string | SQL string starting with ALTER TABLE |
Definition at line 594 of file class.t3lib_sqlparser.php.
References getValue(), t3lib_div\inList(), nextPart(), parseError(), parseFieldDef(), and trimSQL().
Referenced by parseSQL().
| t3lib_sqlparser::parseCaseStatement | ( | &$ | parseString | ) | [protected] |
Parsing a CASE ... WHEN flow-control construct. The output from this function can be compiled back with ->compileCaseStatement()
| string | The string with the CASE ... WHEN construct, eg. "CASE field WHEN 1 THEN 0 ELSE ..." etc. NOTICE: passed by reference! |
Definition at line 934 of file class.t3lib_sqlparser.php.
References $value, getValue(), nextPart(), parseError(), and parseWhereClause().
Referenced by parseFieldList().
| t3lib_sqlparser::parseCREATEDATABASE | ( | $ | parseString | ) | [protected] |
Parsing CREATE DATABASE query
| string | SQL string starting with CREATE DATABASE |
Definition at line 723 of file class.t3lib_sqlparser.php.
References nextPart(), parseError(), and trimSQL().
Referenced by parseSQL().
| t3lib_sqlparser::parseCREATETABLE | ( | $ | parseString | ) | [protected] |
Parsing CREATE TABLE query
| string | SQL string starting with CREATE TABLE |
Definition at line 499 of file class.t3lib_sqlparser.php.
References getValue(), nextPart(), parseError(), parseFieldDef(), and trimSQL().
Referenced by parseSQL().
| t3lib_sqlparser::parseDELETE | ( | $ | parseString | ) | [protected] |
Parsing DELETE query
| string | SQL string with DELETE query to parse |
Definition at line 435 of file class.t3lib_sqlparser.php.
References nextPart(), parseError(), parseWhereClause(), and trimSQL().
Referenced by parseSQL().
| t3lib_sqlparser::parseDROPTABLE | ( | $ | parseString | ) | [protected] |
Parsing DROP TABLE query
| string | SQL string starting with DROP TABLE |
Definition at line 688 of file class.t3lib_sqlparser.php.
References nextPart(), parseError(), and trimSQL().
Referenced by parseSQL().
| t3lib_sqlparser::parseError | ( | $ | msg, |
| $ | restQuery | ||
| ) | [protected] |
Setting the internal error message value, $this->parse_error and returns that value.
| string | Input error message |
| string | Remaining query to parse. |
Definition at line 1610 of file class.t3lib_sqlparser.php.
Referenced by getValue(), parseALTERTABLE(), parseCaseStatement(), parseCREATEDATABASE(), parseCREATETABLE(), parseDELETE(), parseDROPTABLE(), parseFieldDef(), parseFieldList(), parseFromTables(), parseINSERT(), parseSELECT(), parseSQL(), parseTRUNCATETABLE(), parseUPDATE(), and parseWhereClause().
| t3lib_sqlparser::parseEXPLAIN | ( | $ | parseString | ) | [protected] |
Parsing EXPLAIN query
| string | SQL string with EXPLAIN query to parse |
Definition at line 477 of file class.t3lib_sqlparser.php.
References parseSELECT(), and trimSQL().
Referenced by parseSQL().
| t3lib_sqlparser::parseFieldDef | ( | &$ | parseString, |
| $ | stopRegex = '' |
||
| ) |
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:]]*)' |
Definition at line 1384 of file class.t3lib_sqlparser.php.
References getValue(), nextPart(), parseError(), and trimSQL().
Referenced by parseALTERTABLE(), parseCREATETABLE(), tx_dbal_sqlengine\processAccordingToConfig(), and t3lib_sqlengine\processAccordingToConfig().
| t3lib_sqlparser::parseFieldList | ( | &$ | parseString, |
| $ | stopRegex = '' |
||
| ) |
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:]]*)' |
Definition at line 798 of file class.t3lib_sqlparser.php.
References nextPart(), parseCaseStatement(), parseError(), and trimSQL().
Referenced by debug_parseSQLpart(), and parseSELECT().
| t3lib_sqlparser::parseFromTables | ( | &$ | parseString, |
| $ | stopRegex = '' |
||
| ) |
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:]]*)' |
Definition at line 970 of file class.t3lib_sqlparser.php.
References nextPart(), parseError(), and trimSQL().
Referenced by debug_parseSQLpart(), tx_dbal_sqlengine\exec_SELECTquery(), t3lib_sqlengine\exec_SELECTquery(), and parseSELECT().
| t3lib_sqlparser::parseINSERT | ( | $ | parseString | ) | [protected] |
Parsing INSERT query
| string | SQL string with INSERT query to parse |
Definition at line 339 of file class.t3lib_sqlparser.php.
References getValue(), nextPart(), parseError(), and trimSQL().
Referenced by parseSQL().
| t3lib_sqlparser::parseSELECT | ( | $ | parseString, |
| &$ | parameterReferences = NULL |
||
| ) | [protected] |
Parsing SELECT query
| string | SQL string with SELECT query to parse |
| array | Array holding references to either named (:name) or question mark (?) parameters found |
Definition at line 189 of file class.t3lib_sqlparser.php.
References nextPart(), parseError(), parseFieldList(), parseFromTables(), parseWhereClause(), and trimSQL().
Referenced by parseEXPLAIN(), parseSQL(), and parseWhereClause().
| t3lib_sqlparser::parseSQL | ( | $ | parseString | ) |
Parses any single SQL query
| string | SQL query |
Definition at line 121 of file class.t3lib_sqlparser.php.
References nextPart(), parseALTERTABLE(), parseCREATEDATABASE(), parseCREATETABLE(), parseDELETE(), parseDROPTABLE(), parseError(), parseEXPLAIN(), parseINSERT(), parseSELECT(), parseTRUNCATETABLE(), parseUPDATE(), and trimSQL().
Referenced by tx_dbal_handler_openoffice\admin_query(), tx_dbal_handler_xmldb\admin_query(), and debug_testSQL().
| t3lib_sqlparser::parseStripslashes | ( | $ | str | ) | [protected] |
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 |
Definition at line 1582 of file class.t3lib_sqlparser.php.
Referenced by getValueInQuotes().
| t3lib_sqlparser::parseTRUNCATETABLE | ( | $ | parseString | ) | [protected] |
Parsing TRUNCATE TABLE query
| string | SQL string starting with TRUNCATE TABLE |
Definition at line 755 of file class.t3lib_sqlparser.php.
References nextPart(), parseError(), and trimSQL().
Referenced by parseSQL().
| t3lib_sqlparser::parseUPDATE | ( | $ | parseString | ) | [protected] |
Parsing UPDATE query
| string | SQL string with UPDATE query to parse |
Definition at line 277 of file class.t3lib_sqlparser.php.
References $value, getValue(), nextPart(), parseError(), parseWhereClause(), and trimSQL().
Referenced by parseSQL().
| t3lib_sqlparser::parseWhereClause | ( | &$ | parseString, |
| $ | stopRegex = '', |
||
| array &$ | parameterReferences = array() |
||
| ) |
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:]]*)' |
| array | Array holding references to either named (:name) or question mark (?) parameters found |
Definition at line 1091 of file class.t3lib_sqlparser.php.
References getValue(), getValueOrParameter(), t3lib_div\inList(), nextPart(), parseError(), parseSELECT(), and trimSQL().
Referenced by debug_parseSQLpart(), tx_dbal_sqlengine\exec_DELETEquery(), t3lib_sqlengine\exec_DELETEquery(), tx_dbal_sqlengine\exec_SELECTquery(), t3lib_sqlengine\exec_SELECTquery(), tx_dbal_sqlengine\exec_UPDATEquery(), t3lib_sqlengine\exec_UPDATEquery(), parseCaseStatement(), parseDELETE(), parseSELECT(), and parseUPDATE().
| t3lib_sqlparser::trimSQL | ( | $ | str | ) | [protected] |
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 |
Definition at line 1624 of file class.t3lib_sqlparser.php.
Referenced by debug_parseSQLpartCompare(), parseALTERTABLE(), parseCREATEDATABASE(), parseCREATETABLE(), parseDELETE(), parseDROPTABLE(), parseEXPLAIN(), parseFieldDef(), parseFieldList(), parseFromTables(), parseINSERT(), parseSELECT(), parseSQL(), parseTRUNCATETABLE(), parseUPDATE(), and parseWhereClause().
| t3lib_sqlparser::$lastStopKeyWord = '' |
Definition at line 105 of file class.t3lib_sqlparser.php.
| t3lib_sqlparser::$parse_error = '' |
Definition at line 104 of file class.t3lib_sqlparser.php.
1.7.5.1