Libs changes for php 8.x

This commit is contained in:
Sumit Panwar
2025-05-23 10:46:00 +05:30
parent 178e8fa28a
commit fa0a498733
1185 changed files with 92175 additions and 58962 deletions

View File

@@ -76,7 +76,7 @@ class FromProcessor extends AbstractProcessor {
}
// loop init
return array('expression' => "", 'token_count' => 0, 'table' => "", 'no_quotes' => "", 'alias' => false,
'hints' => false, 'join_type' => "", 'next_join_type' => "",
'hints' => array(), 'join_type' => "", 'next_join_type' => "",
'saved_join_type' => $parseInfo['saved_join_type'], 'ref_type' => false, 'ref_expr' => false,
'base_expr' => false, 'sub_tree' => false, 'subquery' => "");
}
@@ -84,13 +84,17 @@ class FromProcessor extends AbstractProcessor {
protected function processFromExpression(&$parseInfo) {
$res = array();
if ($parseInfo['hints'] === array()) {
$parseInfo['hints'] = false;
}
// exchange the join types (join_type is save now, saved_join_type holds the next one)
$parseInfo['join_type'] = $parseInfo['saved_join_type']; // initialized with JOIN
$parseInfo['saved_join_type'] = ($parseInfo['next_join_type'] ? $parseInfo['next_join_type'] : 'JOIN');
// we have a reg_expr, so we have to parse it
if ($parseInfo['ref_expr'] !== false) {
$unparsed = $this->splitSQLIntoTokens($parseInfo['ref_expr']);
$unparsed = $this->splitSQLIntoTokens(trim($parseInfo['ref_expr']));
// here we can get a comma separated list
foreach ($unparsed as $k => $v) {
@@ -186,6 +190,11 @@ class FromProcessor extends AbstractProcessor {
if ($token_category === 'LEFT' || $token_category === 'RIGHT' || $token_category === 'NATURAL') {
$token_category = '';
$parseInfo['next_join_type'] = strtoupper(trim($prevToken)); // it seems to be a join
} elseif ($token_category === 'IDX_HINT') {
$parseInfo['expression'] .= $token;
if ($parseInfo['ref_type'] !== false) { // all after ON / USING
$parseInfo['ref_expr'] .= $token;
}
}
break;
@@ -272,6 +281,12 @@ class FromProcessor extends AbstractProcessor {
break;
case 'FOR':
if ($token_category === 'IDX_HINT') {
$cur_hint = (count($parseInfo['hints']) - 1);
$parseInfo['hints'][$cur_hint]['hint_type'] .= " " . $upper;
continue 2;
}
$parseInfo['token_count']++;
$skip_next = true;
break;
@@ -291,6 +306,12 @@ class FromProcessor extends AbstractProcessor {
$parseInfo['next_join_type'] = 'CROSS';
case 'JOIN':
if ($token_category === 'IDX_HINT') {
$cur_hint = (count($parseInfo['hints']) - 1);
$parseInfo['hints'][$cur_hint]['hint_type'] .= " " . $upper;
continue 2;
}
if ($parseInfo['subquery']) {
$parseInfo['sub_tree'] = $this->parse($this->removeParenthesisFromStart($parseInfo['subquery']));
$parseInfo['expression'] = $parseInfo['subquery'];
@@ -300,6 +321,13 @@ class FromProcessor extends AbstractProcessor {
$parseInfo = $this->initParseInfo($parseInfo);
break;
case 'GROUP BY':
if ($token_category === 'IDX_HINT') {
$cur_hint = (count($parseInfo['hints']) - 1);
$parseInfo['hints'][$cur_hint]['hint_type'] .= " " . $upper;
continue 2;
}
default:
// TODO: enhance it, so we can have base_expr to calculate the position of the keywords
// build a subtree under "hints"