/** * @inheritDoc */ public function parse(QuoteInterface $quotingInterface) { return $quotingInterface->quote($this->format(self::POSTGRES_ISO_8601)); }
/** * @inheritDoc */ public function parse(QuoteInterface $quoting) { return $quoting->quote($this->oid); }
/** * @inheritDoc */ public function parse(QuoteInterface $quoting) { if (!isset($this->sqlIdentifier)) { throw new \RuntimeException("You can't use a Bond\\Set in a Query object without first setting its \$this->sqlIdentifier property."); } $numIntervals = count($this->intervals); $currentInterval = 0; $sqlFragments = array(); // the full range if ($numIntervals === 1 and $this->intervals[0] === array(null, null)) { // with null, this matches everything if ($this->containsNull) { return "TRUE"; } else { // just not null values $sqlFragments[] = sprintf("%s IS NOT NULL", $this->sqlIdentifier); $currentInterval++; } // we've potentially got range(s) } elseif ($numIntervals) { // We'll only ever have one < test and one > test. Lets handle those. if ($this->intervals[0][0] === null) { $currentInterval++; $sqlFragments[] = sprintf("%s <= %s", $this->sqlIdentifier, $quoting->quote($this->intervals[0][1])); } if ($this->intervals[$numIntervals - 1][1] === null) { $sqlFragments[] .= sprintf("%s >= %s", $this->sqlIdentifier, $quoting->quote($this->intervals[$numIntervals - 1][0])); $numIntervals--; } } // all these will be BETWEEN statements or IN values $sqlValues = array(); for (; $currentInterval < $numIntervals; $currentInterval++) { // in values if ($this->intervals[$currentInterval][0] === $this->intervals[$currentInterval][1]) { $sqlValues[] = $quoting->quote($this->intervals[$currentInterval][0]); // between } else { $sqlFragments[] = sprintf("%s BETWEEN %s AND %s", $this->sqlIdentifier, $quoting->quote($this->intervals[$currentInterval][0]), $quoting->quote($this->intervals[$currentInterval][1])); } } // NULL if ($this->containsNull) { $sqlFragments[] = sprintf("%s IS NULL", $this->sqlIdentifier); } // turn any sql values into a IN statement if ($sqlValues) { $sqlFragments[] = sprintf("%s IN (%s)", $this->sqlIdentifier, implode(',', $sqlValues)); } return count($sqlFragments) ? "( " . implode(' OR ', $sqlFragments) . " )" : "FALSE"; }
/** * @inheritDoc */ public function parse(QuoteInterface $quotingInterface) { return $quotingInterface->quote($this->__toString()); }