Documentation TYPO3 par Ameos |
Public Member Functions | |
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) | |
Public Attributes | |
$parse_error = '' | |
$lastStopKeyWord = '' |
Definition at line 107 of file class.t3lib_sqlparser.php.
t3lib_sqlparser::parseSQL | ( | $ | parseString | ) |
Parses any single SQL query
string | SQL query |
Definition at line 129 of file class.t3lib_sqlparser.php.
References nextPart(), parseALTERTABLE(), parseCREATEDATABASE(), parseCREATETABLE(), parseDELETE(), parseDROPTABLE(), parseError(), parseEXPLAIN(), parseINSERT(), parseSELECT(), parseUPDATE(), and trimSQL().
Referenced by tx_dbal_handler_xmldb::admin_query(), and tx_dbal_handler_openoffice::admin_query().
t3lib_sqlparser::parseSELECT | ( | $ | parseString | ) |
Parsing SELECT query
string | SQL string with SELECT query to parse |
Definition at line 192 of file class.t3lib_sqlparser.php.
Referenced by parseSQL().
t3lib_sqlparser::parseUPDATE | ( | $ | parseString | ) |
Parsing UPDATE query
string | SQL string with UPDATE query to parse |
Definition at line 261 of file class.t3lib_sqlparser.php.
Referenced by parseSQL().
t3lib_sqlparser::parseINSERT | ( | $ | parseString | ) |
Parsing INSERT query
string | SQL string with INSERT query to parse |
Definition at line 315 of file class.t3lib_sqlparser.php.
Referenced by parseSQL().
t3lib_sqlparser::parseDELETE | ( | $ | parseString | ) |
Parsing DELETE query
string | SQL string with DELETE query to parse |
Definition at line 375 of file class.t3lib_sqlparser.php.
Referenced by parseSQL().
t3lib_sqlparser::parseEXPLAIN | ( | $ | parseString | ) |
Parsing EXPLAIN query
string | SQL string with EXPLAIN query to parse |
Definition at line 413 of file class.t3lib_sqlparser.php.
Referenced by parseSQL().
t3lib_sqlparser::parseCREATETABLE | ( | $ | parseString | ) |
Parsing CREATE TABLE query
string | SQL string starting with CREATE TABLE |
Definition at line 435 of file class.t3lib_sqlparser.php.
Referenced by parseSQL().
t3lib_sqlparser::parseALTERTABLE | ( | $ | parseString | ) |
Parsing ALTER TABLE query
string | SQL string starting with ALTER TABLE |
Definition at line 514 of file class.t3lib_sqlparser.php.
Referenced by parseSQL().
t3lib_sqlparser::parseDROPTABLE | ( | $ | parseString | ) |
Parsing DROP TABLE query
string | SQL string starting with DROP TABLE |
Definition at line 583 of file class.t3lib_sqlparser.php.
Referenced by parseSQL().
t3lib_sqlparser::parseCREATEDATABASE | ( | $ | parseString | ) |
Parsing CREATE DATABASE query
string | SQL string starting with CREATE DATABASE |
Definition at line 616 of file class.t3lib_sqlparser.php.
Referenced by parseSQL().
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 670 of file class.t3lib_sqlparser.php.
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 791 of file class.t3lib_sqlparser.php.
Referenced by t3lib_sqlengine::exec_SELECTquery().
t3lib_sqlparser::parseWhereClause | ( | &$ | 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 882 of file class.t3lib_sqlparser.php.
Referenced by t3lib_sqlengine::exec_DELETEquery(), t3lib_sqlengine::exec_SELECTquery(), and t3lib_sqlengine::exec_UPDATEquery().
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 990 of file class.t3lib_sqlparser.php.
Referenced by t3lib_sqlengine::processAccordingToConfig().
t3lib_sqlparser::nextPart | ( | &$ | parseString, | |
$ | regex, | |||
$ | trimAll = FALSE | |||
) |
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 1053 of file class.t3lib_sqlparser.php.
Referenced by parseSQL().
t3lib_sqlparser::getValue | ( | &$ | parseString, | |
$ | comparator = '' | |||
) |
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) |
Definition at line 1068 of file class.t3lib_sqlparser.php.
t3lib_sqlparser::getValueInQuotes | ( | &$ | parseString, | |
$ | quote | |||
) |
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 1126 of file class.t3lib_sqlparser.php.
t3lib_sqlparser::parseStripslashes | ( | $ | str | ) |
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 1152 of file class.t3lib_sqlparser.php.
t3lib_sqlparser::compileAddslashes | ( | $ | str | ) |
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 |
Definition at line 1166 of file class.t3lib_sqlparser.php.
t3lib_sqlparser::parseError | ( | $ | msg, | |
$ | restQuery | |||
) |
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 1181 of file class.t3lib_sqlparser.php.
Referenced by parseSQL().
t3lib_sqlparser::trimSQL | ( | $ | str | ) |
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 1195 of file class.t3lib_sqlparser.php.
Referenced by parseSQL().
t3lib_sqlparser::compileSQL | ( | $ | components | ) |
Compiles an SQL query from components
array | Array of SQL query components |
Reimplemented in ux_t3lib_sqlengine, and ux_t3lib_sqlparser.
Definition at line 1224 of file class.t3lib_sqlparser.php.
t3lib_sqlparser::compileSELECT | ( | $ | components | ) |
Compiles a SELECT statement from components array
array | Array of SQL query components |
Definition at line 1262 of file class.t3lib_sqlparser.php.
Referenced by ux_t3lib_sqlparser::compileSQL(), and ux_t3lib_sqlengine::compileSQL().
t3lib_sqlparser::compileUPDATE | ( | $ | components | ) |
Compiles an UPDATE statement from components array
array | Array of SQL query components |
Definition at line 1293 of file class.t3lib_sqlparser.php.
Referenced by ux_t3lib_sqlparser::compileSQL(), and ux_t3lib_sqlengine::compileSQL().
t3lib_sqlparser::compileINSERT | ( | $ | components | ) |
Compiles an INSERT statement from components array
array | Array of SQL query components |
Reimplemented in ux_t3lib_sqlengine, and ux_t3lib_sqlparser.
Definition at line 1321 of file class.t3lib_sqlparser.php.
t3lib_sqlparser::compileDELETE | ( | $ | components | ) |
Compiles an DELETE statement from components array
array | Array of SQL query components |
Definition at line 1361 of file class.t3lib_sqlparser.php.
Referenced by ux_t3lib_sqlparser::compileSQL(), and ux_t3lib_sqlengine::compileSQL().
t3lib_sqlparser::compileCREATETABLE | ( | $ | components | ) |
Compiles a CREATE TABLE statement from components array
array | Array of SQL query components |
Reimplemented in ux_t3lib_sqlengine, and ux_t3lib_sqlparser.
Definition at line 1381 of file class.t3lib_sqlparser.php.
t3lib_sqlparser::compileALTERTABLE | ( | $ | components | ) |
Compiles an ALTER TABLE statement from components array
array | Array of SQL query components |
Reimplemented in ux_t3lib_sqlengine, and ux_t3lib_sqlparser.
Definition at line 1414 of file class.t3lib_sqlparser.php.
t3lib_sqlparser::compileFieldList | ( | $ | selectFields | ) |
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()) |
Definition at line 1467 of file class.t3lib_sqlparser.php.
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 1509 of file class.t3lib_sqlparser.php.
t3lib_sqlparser::compileWhereClause | ( | $ | clauseArray | ) |
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 |
Definition at line 1550 of file class.t3lib_sqlparser.php.
References t3lib_div::inList().
t3lib_sqlparser::compileFieldCfg | ( | $ | fieldCfg | ) |
Compile field definition
array | Field definition parts |
Reimplemented in ux_t3lib_sqlengine, and ux_t3lib_sqlparser.
Definition at line 1604 of file class.t3lib_sqlparser.php.
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 1653 of file class.t3lib_sqlparser.php.
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 1678 of file class.t3lib_sqlparser.php.
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 1711 of file class.t3lib_sqlparser.php.