本文整理匯總了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);
}