public function __construct(AST\Node $AST, $sqlWalker)
 {
     parent::__construct($AST, $sqlWalker);
     if ($AST instanceof AST\UpdateStatement) {
         $this->_sqlStatements = $sqlWalker->walkUpdateStatement($AST);
     } else {
         if ($AST instanceof AST\DeleteStatement) {
             $this->_sqlStatements = $sqlWalker->walkDeleteStatement($AST);
         }
     }
 }
Exemple #2
0
 /**
  * Parses a query string.
  * 
  * @return ParserResult
  */
 public function parse()
 {
     // Parse & build AST
     $AST = $this->_QueryLanguage();
     // Check for end of string
     if ($this->_lexer->lookahead !== null) {
         //var_dump($this->_lexer->lookahead);
         $this->syntaxError('end of string');
     }
     // Create SqlWalker who creates the SQL from the AST
     $sqlWalker = new SqlWalker($this->_query, $this->_parserResult, $this->_queryComponents);
     // Assign an SQL executor to the parser result
     $this->_parserResult->setSqlExecutor(Exec\AbstractExecutor::create($AST, $sqlWalker));
     return $this->_parserResult;
 }