當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SqlParser::parseNextElementRaw方法代碼示例

本文整理匯總了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;
 }
開發者ID:yunsite,項目名稱:mapleleaf,代碼行數:49,代碼來源:expression.php

示例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);
 }
開發者ID:Giannos99,項目名稱:HC_Interaction,代碼行數:33,代碼來源:resultset.php


注:本文中的SqlParser::parseNextElementRaw方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。