@@ -24,7 +24,6 @@ |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | - * @param string $caller |
|
| 28 | 27 | */ |
| 29 | 28 | public function isOk($parameters = null) |
| 30 | 29 | { |
@@ -635,6 +635,9 @@ discard block |
||
| 635 | 635 | }); |
| 636 | 636 | } |
| 637 | 637 | |
| 638 | + /** |
|
| 639 | + * @param \Closure $callback |
|
| 640 | + */ |
|
| 638 | 641 | private static function array_map_deep($array, $callback) |
| 639 | 642 | { |
| 640 | 643 | $new = array(); |
@@ -661,7 +664,7 @@ discard block |
||
| 661 | 664 | * @param array $parameters |
| 662 | 665 | * @param string $delimiter |
| 663 | 666 | * @param bool|string $wrapInBrackets |
| 664 | - * @param int|number $indent |
|
| 667 | + * @param integer $indent |
|
| 665 | 668 | * @param int $conditionsMode |
| 666 | 669 | * |
| 667 | 670 | * @return null|string |
@@ -181,7 +181,7 @@ |
||
| 181 | 181 | * |
| 182 | 182 | * @param Connection $dbConnection |
| 183 | 183 | * @param array $parameters |
| 184 | - * @param number $indent |
|
| 184 | + * @param integer $indent |
|
| 185 | 185 | * @param int $conditionsMode |
| 186 | 186 | * |
| 187 | 187 | * @return string |
@@ -57,6 +57,9 @@ discard block |
||
| 57 | 57 | $this->allTables = array(); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | + /** |
|
| 61 | + * @param string $txt |
|
| 62 | + */ |
|
| 60 | 63 | public static function dbgprint($txt) |
| 61 | 64 | { |
| 62 | 65 | if (isset($_ENV['DEBUG'])) { |
@@ -95,6 +98,9 @@ discard block |
||
| 95 | 98 | return 'DELETE'; |
| 96 | 99 | } |
| 97 | 100 | |
| 101 | + /** |
|
| 102 | + * @param string $column |
|
| 103 | + */ |
|
| 98 | 104 | public static function getColumnNameFor($column) |
| 99 | 105 | { |
| 100 | 106 | if (strtolower($column) === 'uid') { |
@@ -198,6 +204,10 @@ discard block |
||
| 198 | 204 | return ($res >= 1); |
| 199 | 205 | } |
| 200 | 206 | |
| 207 | + /** |
|
| 208 | + * @param string $table |
|
| 209 | + * @param string $column |
|
| 210 | + */ |
|
| 201 | 211 | protected function isCLOBColumn($table, $column) |
| 202 | 212 | { |
| 203 | 213 | $tables = end($this->allTables); |
@@ -314,6 +324,9 @@ discard block |
||
| 314 | 324 | return 'SELECT '.$sql; |
| 315 | 325 | } |
| 316 | 326 | |
| 327 | + /** |
|
| 328 | + * @param string $sql |
|
| 329 | + */ |
|
| 317 | 330 | private function correctColRefStatement($sql) |
| 318 | 331 | { |
| 319 | 332 | $alias = ''; |
@@ -237,6 +237,10 @@ |
||
| 237 | 237 | |
| 238 | 238 | # backticks are not balanced within one token, so we have |
| 239 | 239 | # to re-combine some tokens |
| 240 | + |
|
| 241 | + /** |
|
| 242 | + * @param integer $idx |
|
| 243 | + */ |
|
| 240 | 244 | private function balanceCharacter($tokens, $idx, $char) |
| 241 | 245 | { |
| 242 | 246 | $token_count = count($tokens); |
@@ -43,7 +43,6 @@ discard block |
||
| 43 | 43 | /** |
| 44 | 44 | * Prints an array only if debug mode is on. |
| 45 | 45 | * |
| 46 | - * @param array $s |
|
| 47 | 46 | * @param bool $return, if true, the formatted array is returned via return parameter |
| 48 | 47 | */ |
| 49 | 48 | protected function preprint($arr, $return = false) |
@@ -80,6 +79,7 @@ discard block |
||
| 80 | 79 | |
| 81 | 80 | /** |
| 82 | 81 | * Revokes the escaping characters from an expression. |
| 82 | + * @param string $sql |
|
| 83 | 83 | */ |
| 84 | 84 | protected function revokeEscaping($sql) |
| 85 | 85 | { |
@@ -73,6 +73,9 @@ discard block |
||
| 73 | 73 | return $parsed; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | + /** |
|
| 77 | + * @param string $sql |
|
| 78 | + */ |
|
| 76 | 79 | private function findPositionWithinString($sql, $value, $expr_type) |
| 77 | 80 | { |
| 78 | 81 | $offset = 0; |
@@ -130,6 +133,10 @@ discard block |
||
| 130 | 133 | return $pos; |
| 131 | 134 | } |
| 132 | 135 | |
| 136 | + /** |
|
| 137 | + * @param integer $charPos |
|
| 138 | + * @param integer $key |
|
| 139 | + */ |
|
| 133 | 140 | private function lookForBaseExpression($sql, &$charPos, &$parsed, $key, &$backtracking) |
| 134 | 141 | { |
| 135 | 142 | if (!is_numeric($key)) { |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | { |
| 45 | 45 | private static $allowedOnOperator = array("\t", "\n", "\r", ' ', ',', '(', ')', '_', "'", '"'); |
| 46 | 46 | private static $allowedOnOther = array("\t", "\n", "\r", ' ', ',', '(', ')', '<', '>', '*', '+', '-', '/', '|', |
| 47 | - '&', '=', '!', ';', ); |
|
| 47 | + '&', '=', '!', ';', ); |
|
| 48 | 48 | |
| 49 | 49 | private function printPos($text, $sql, $charPos, $key, $parsed, $backtracking) |
| 50 | 50 | { |
@@ -51,6 +51,9 @@ discard block |
||
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | + /** |
|
| 55 | + * @param string|boolean $sql |
|
| 56 | + */ |
|
| 54 | 57 | public function parse($sql, $calcPositions = false) |
| 55 | 58 | { |
| 56 | 59 | #lex the SQL statement |
@@ -499,6 +502,9 @@ discard block |
||
| 499 | 502 | return $this->processSQLParts($out); |
| 500 | 503 | } |
| 501 | 504 | |
| 505 | + /** |
|
| 506 | + * @param boolean $out |
|
| 507 | + */ |
|
| 502 | 508 | private function processSQLParts($out) |
| 503 | 509 | { |
| 504 | 510 | if (!$out) { |
@@ -565,6 +571,7 @@ discard block |
||
| 565 | 571 | /** |
| 566 | 572 | * A SET list is simply a list of key = value expressions separated by comma (,). |
| 567 | 573 | * This function produces a list of the key/value expressions. |
| 574 | + * @param string $base_expr |
|
| 568 | 575 | */ |
| 569 | 576 | private function getAssignment($base_expr) |
| 570 | 577 | { |
@@ -574,6 +581,9 @@ discard block |
||
| 574 | 581 | 'sub_tree' => $assignment, ); |
| 575 | 582 | } |
| 576 | 583 | |
| 584 | + /** |
|
| 585 | + * @param string $expression |
|
| 586 | + */ |
|
| 577 | 587 | private function getVariableType($expression) |
| 578 | 588 | { |
| 579 | 589 | // $expression must contain only upper-case characters |
@@ -601,6 +611,7 @@ discard block |
||
| 601 | 611 | |
| 602 | 612 | /** |
| 603 | 613 | * It can be UPDATE SET or SET alone. |
| 614 | + * @param boolean $isUpdate |
|
| 604 | 615 | */ |
| 605 | 616 | private function process_set_list($tokens, $isUpdate) |
| 606 | 617 | { |
@@ -730,6 +741,9 @@ discard block |
||
| 730 | 741 | return (trim($token) === ''); |
| 731 | 742 | } |
| 732 | 743 | |
| 744 | + /** |
|
| 745 | + * @param string $token |
|
| 746 | + */ |
|
| 733 | 747 | private function isCommentToken($token) |
| 734 | 748 | { |
| 735 | 749 | return isset($token[0]) && isset($token[1]) |
@@ -1490,6 +1504,7 @@ discard block |
||
| 1490 | 1504 | |
| 1491 | 1505 | /** |
| 1492 | 1506 | * This method handles INSERT and REPLACE statements. |
| 1507 | + * @param string $token_category |
|
| 1493 | 1508 | */ |
| 1494 | 1509 | private function processInsertOrReplace($tokenList, $token_category) |
| 1495 | 1510 | { |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | $assignment = $this->process_expr_list($this->splitSQLIntoTokens($base_expr)); |
| 572 | 572 | |
| 573 | 573 | return array('expr_type' => ExpressionType::EXPRESSION, 'base_expr' => trim($base_expr), |
| 574 | - 'sub_tree' => $assignment, ); |
|
| 574 | + 'sub_tree' => $assignment, ); |
|
| 575 | 575 | } |
| 576 | 576 | |
| 577 | 577 | private function getVariableType($expression) |
@@ -843,7 +843,7 @@ discard block |
||
| 843 | 843 | || $this->isFunction($prev) || $this->isExpression($prev) || $this->isSubQuery($prev) |
| 844 | 844 | || $this->isColumnReference($prev) || $this->isBracketExpression($prev)) { |
| 845 | 845 | $alias = array('as' => false, 'name' => trim($last['base_expr']), |
| 846 | - 'base_expr' => trim($last['base_expr']), ); |
|
| 846 | + 'base_expr' => trim($last['base_expr']), ); |
|
| 847 | 847 | #remove the last token |
| 848 | 848 | array_pop($tokens); |
| 849 | 849 | $base_expr = implode('', $tokens); |
@@ -873,7 +873,7 @@ discard block |
||
| 873 | 873 | } |
| 874 | 874 | |
| 875 | 875 | return array('expr_type' => $type, 'alias' => $alias, 'base_expr' => trim($base_expr), |
| 876 | - 'sub_tree' => $processed, ); |
|
| 876 | + 'sub_tree' => $processed, ); |
|
| 877 | 877 | } |
| 878 | 878 | |
| 879 | 879 | /** |
@@ -1013,9 +1013,9 @@ discard block |
||
| 1013 | 1013 | } |
| 1014 | 1014 | # loop init |
| 1015 | 1015 | return array('expression' => '', 'token_count' => 0, 'table' => '', 'alias' => false, 'join_type' => '', |
| 1016 | - 'next_join_type' => '', 'saved_join_type' => $parseInfo['saved_join_type'], |
|
| 1017 | - 'ref_type' => false, 'ref_expr' => false, 'base_expr' => false, 'sub_tree' => false, |
|
| 1018 | - 'subquery' => '', ); |
|
| 1016 | + 'next_join_type' => '', 'saved_join_type' => $parseInfo['saved_join_type'], |
|
| 1017 | + 'ref_type' => false, 'ref_expr' => false, 'base_expr' => false, 'sub_tree' => false, |
|
| 1018 | + 'subquery' => '', ); |
|
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | 1021 | private function processFromExpression(&$parseInfo) |
@@ -1099,7 +1099,7 @@ discard block |
||
| 1099 | 1099 | } |
| 1100 | 1100 | |
| 1101 | 1101 | return array('expr_type' => $parseInfo['type'], 'base_expr' => $parseInfo['expr'], |
| 1102 | - 'direction' => $parseInfo['dir'], ); |
|
| 1102 | + 'direction' => $parseInfo['dir'], ); |
|
| 1103 | 1103 | } |
| 1104 | 1104 | |
| 1105 | 1105 | private function initParseInfoForOrder() |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | class LexerSplitter |
| 38 | 38 | { |
| 39 | 39 | private static $splitters = array("\r\n", '!=', '>=', '<=', '<>', ':=', '\\', '&&', '>', '<', '|', '=', '^', '(', |
| 40 | - ')', "\t", "\n", "'", '"', '`', ',', '@', ' ', '+', '-', '*', '/', ';', ); |
|
| 40 | + ')', "\t", "\n", "'", '"', '`', ',', '@', ' ', '+', '-', '*', '/', ';', ); |
|
| 41 | 41 | private $tokenSize; |
| 42 | 42 | private $hashSet; |
| 43 | 43 | |