protected function visitBinaryOperation(O\BinaryOperationExpression $expression) { $operator = $expression->getOperator(); switch ($operator) { case Operators\Binary::INEQUALITY: $this->walk(O\Expression::unaryOperation(Operators\Unary::NOT, $expression->update($expression->getLeftOperand(), Operators\Binary::EQUALITY, $expression->getRightOperand()))); return; case Operators\Binary::CONCATENATION: $this->sql .= 'CONCAT('; $this->walk($expression->getLeftOperand()); $this->sql .= ', '; $this->walk($expression->getRightOperand()); $this->sql .= ')'; return; } if (!isset($this->binaryOperators[$operator])) { throw new PinqDemoSqlException("Binary operator not supported: {$operator}"); } $this->sql .= '('; $this->walk($expression->getLeftOperand()); $this->sql .= ' '; $this->sql .= $this->binaryOperators[$operator]; $this->sql .= ' '; $this->walk($expression->getRightOperand()); $this->sql .= ')'; }
public function visitBinaryOperation(O\BinaryOperationExpression $expression) { $this->walk($expression->getLeftOperand()); $this->walk($expression->getRightOperand()); $binaryOperation = $this->typeSystem->getBinaryOperation($this->analysis[$expression->getLeftOperand()], $expression->getOperator(), $this->analysis[$expression->getRightOperand()]); $this->metadata[$expression] = $binaryOperation; $this->analysis[$expression] = $binaryOperation->getReturnType(); }