Esempio n. 1
0
 public function process($tokenList, $token_category = 'INSERT')
 {
     $table = "";
     $cols = array();
     $into = $tokenList['INTO'];
     foreach ($into as $token) {
         if ($this->isWhitespaceToken($token)) {
             continue;
         }
         if ($table === "") {
             $table = $token;
         } elseif (empty($cols)) {
             $cols[] = $token;
         }
     }
     if (empty($cols)) {
         $cols = false;
     } else {
         $processor = new ColumnListProcessor();
         $cols = $processor->process($this->removeParenthesisFromStart($cols[0]));
     }
     unset($tokenList['INTO']);
     $tokenList[$token_category][0] = array('table' => $table, 'columns' => $cols, 'base_expr' => $table, 'no_quotes' => $this->revokeQuotation($table));
     return $tokenList;
 }
 protected function processColumnList($unparsed)
 {
     $processor = new ColumnListProcessor();
     $expr = $this->removeParenthesisFromStart($unparsed);
     return $processor->process($expr);
 }
Esempio n. 3
0
 protected function processColumns($cols)
 {
     if ($cols === false) {
         return $cols;
     }
     if ($cols[0] === '(' && substr($cols, -1) === ')') {
         $parsed = array('expr_type' => ExpressionType::BRACKET_EXPRESSION, 'base_expr' => $cols, 'sub_tree' => false);
     }
     $cols = $this->removeParenthesisFromStart($cols);
     if (stripos($cols, 'SELECT') === 0) {
         $processor = new DefaultProcessor();
         $parsed['sub_tree'] = array(array('expr_type' => ExpressionType::QUERY, 'base_expr' => $cols, 'sub_tree' => $processor->process($cols)));
     } else {
         $processor = new ColumnListProcessor();
         $parsed['sub_tree'] = $processor->process($cols);
         $parsed['expr_type'] = ExpressionType::COLUMN_LIST;
     }
     return $parsed;
 }