Ejemplo n.º 1
0
 public function process($tokens)
 {
     $expression = "";
     $expressionList = array();
     foreach ($tokens as $token) {
         if ($this->isCommaToken($token)) {
             $expression = parent::process(trim($expression));
             $expression['delim'] = ',';
             $expressionList[] = $expression;
             $expression = "";
         } else {
             if ($this->isCommentToken($token)) {
                 $expressionList[] = parent::processComment($token);
             } else {
                 switch (strtoupper($token)) {
                     // add more SELECT options here
                     case 'DISTINCT':
                     case 'DISTINCTROW':
                     case 'HIGH_PRIORITY':
                     case 'SQL_CACHE':
                     case 'SQL_NO_CACHE':
                     case 'SQL_CALC_FOUND_ROWS':
                     case 'STRAIGHT_JOIN':
                     case 'SQL_SMALL_RESULT':
                     case 'SQL_BIG_RESULT':
                     case 'SQL_BUFFER_RESULT':
                         $expression = parent::process(trim($token));
                         $expression['delim'] = ' ';
                         $expressionList[] = $expression;
                         $expression = "";
                         break;
                     default:
                         $expression .= $token;
                 }
             }
         }
     }
     if ($expression) {
         $expression = parent::process(trim($expression));
         $expression['delim'] = false;
         $expressionList[] = $expression;
     }
     return $expressionList;
 }
Ejemplo n.º 2
0
 protected function processSelectExpression($unparsed)
 {
     $processor = new SelectExpressionProcessor();
     return $processor->process($unparsed);
 }