Beispiel #1
0
 /**
  * DeleteStatement ::= DeleteClause [WhereClause]
  */
 public function _DeleteStatement()
 {
     $deleteStatement = new AST\DeleteStatement($this->_DeleteClause());
     $deleteStatement->setWhereClause($this->_lexer->isNextToken(Lexer::T_WHERE) ? $this->_WhereClause() : null);
     return $deleteStatement;
 }
Beispiel #2
0
 /**
  * Walks down a DeleteStatement AST node, thereby generating the appropriate SQL.
  *
  * @param DeleteStatement
  * @return string The SQL.
  */
 public function walkDeleteStatement(AST\DeleteStatement $AST)
 {
     $this->_useSqlTableAliases = false;
     // TODO: Ask platform instead?
     $sql = $this->walkDeleteClause($AST->getDeleteClause());
     if ($whereClause = $AST->getWhereClause()) {
         $sql .= $this->walkWhereClause($whereClause);
     } else {
         if ($discSql = $this->_generateDiscriminatorColumnConditionSql($this->_currentRootAlias)) {
             $sql .= ' WHERE ' . $discSql;
         }
     }
     return $sql;
 }