本文整理汇总了PHP中SqlParser::parseNextElementRaw方法的典型用法代码示例。如果您正苦于以下问题:PHP SqlParser::parseNextElementRaw方法的具体用法?PHP SqlParser::parseNextElementRaw怎么用?PHP SqlParser::parseNextElementRaw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlParser
的用法示例。
在下文中一共展示了SqlParser::parseNextElementRaw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getExpressionTree
function getExpressionTree($expr)
{
global $g_sqlSingleRecFuncs;
$parser = new SqlParser($expr);
$king_expr = new Expression();
$current_expr =& $king_expr;
while (!is_empty_str($elem = $parser->parseNextElementRaw())) {
// function or IN / NOT IN?
if (in_array(strtoupper($elem), $g_sqlSingleRecFuncs) || strtoupper($elem) == "IN" || strtoupper($elem) == "NOT IN") {
$current_expr->expr_str .= $elem . " ";
$elem = $parser->parseNextElementRaw();
if ($elem != "(") {
print_error_msg("( expected after " . $current_expr->expr_str);
return null;
}
$current_expr->expr_str .= $elem;
while (!is_empty_str($elem = $parser->parseNextElementRaw()) && $elem != ")") {
$current_expr->expr_str .= $elem;
}
$current_expr->expr_str .= $elem . " ";
continue;
}
if ($elem == "(") {
$current_expr->expr_str .= " % ";
unset($new_expr);
$new_expr = new Expression("");
$current_expr->addChild($new_expr);
$new_expr->setParent($current_expr);
unset($current_expr);
$current_expr =& $new_expr;
} else {
if ($elem == ")") {
unset($tmp);
$tmp =& $current_expr->getParent();
unset($current_expr);
$current_expr =& $tmp;
} else {
// no spaces on .'s
if ($elem == ".") {
remove_last_char($current_expr->expr_str);
$current_expr->expr_str .= $elem;
} else {
$current_expr->expr_str .= $elem . " ";
}
}
}
}
return $king_expr;
}
示例2: generateAdditionalColumnsFromWhereExpr
function generateAdditionalColumnsFromWhereExpr($where_expr)
{
global $g_sqlSingleRecFuncs;
$parser = new SqlParser($where_expr);
$elem = "";
$colFuncs = array();
$colNames = array();
$colTables = array();
$index = -1;
while (!is_empty_str($elem = $parser->parseNextElementRaw())) {
// function ?
if (in_array(strtoupper($elem), $g_sqlSingleRecFuncs)) {
++$index;
$colNames[$index] = "";
$colTables[$index] = "";
$colFuncs[$index] = strtoupper($elem);
$elem = $parser->parseNextElementRaw();
if ($elem != "(") {
print_error_msg("( expected after {$elem}");
return false;
}
while (!is_empty_str($elem = $parser->parseNextElementRaw()) && $elem != ")") {
if ($elem == ".") {
$colTables[$index] = $colNames[$index];
$colNames[$index] = $parser->parseNextElementRaw();
} else {
$colNames[$index] = $elem;
}
}
}
}
return $this->generateAdditionalColumnsFromArrays($colNames, $colTables, $colFuncs);
}