protected function processWhere(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null) { if ($this->where->count() == 0) { return; } return [$this->processExpression($this->where, $platform, $driver, $parameterContainer, 'where')]; }
/** * Get SQL string for statement * * @param null|PlatformInterface $adapterPlatform If null, defaults to Sql92 * @return string */ public function getSqlString(PlatformInterface $adapterPlatform = null) { $adapterPlatform = $adapterPlatform ?: new Sql92(); $table = $this->table; $schema = null; // create quoted table name to use in update processing if ($table instanceof TableIdentifier) { list($table, $schema) = $table->getTableAndSchema(); } $table = $adapterPlatform->quoteIdentifier($table); if ($schema) { $table = $adapterPlatform->quoteIdentifier($schema) . $adapterPlatform->getIdentifierSeparator() . $table; } $set = $this->set; if (is_array($set)) { $setSql = array(); foreach ($set as $column => $value) { if ($value instanceof Expression) { $exprData = $this->processExpression($value, $adapterPlatform); $setSql[] = $adapterPlatform->quoteIdentifier($column) . ' = ' . $exprData->getSql(); } elseif ($value === null) { $setSql[] = $adapterPlatform->quoteIdentifier($column) . ' = NULL'; } else { $setSql[] = $adapterPlatform->quoteIdentifier($column) . ' = ' . $adapterPlatform->quoteValue($value); } } $set = implode(', ', $setSql); } $sql = sprintf($this->specifications[static::SPECIFICATION_UPDATE], $table, $set); if ($this->where->count() > 0) { $whereParts = $this->processExpression($this->where, $adapterPlatform, null, 'where'); $sql .= ' ' . sprintf($this->specifications[static::SPECIFICATION_WHERE], $whereParts->getSql()); } return $sql; }
protected function processWhere(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null) { if ($this->where->count() == 0) { return; } return sprintf($this->specifications[static::SPECIFICATION_WHERE], $this->processExpression($this->where, $platform, $driver, $parameterContainer, 'where')); }
/** * Get SQL string for statement * * @param null|PlatformInterface $adapterPlatform If null, defaults to Sql92 * @return string */ public function getSqlString(PlatformInterface $adapterPlatform = null) { $adapterPlatform = $adapterPlatform ?: new Sql92(); $table = $adapterPlatform->quoteIdentifier($this->table); $set = $this->set; if (is_array($set)) { $setSql = array(); foreach ($set as $column => $value) { if ($value instanceof Expression) { $exprData = $this->processExpression($value, $adapterPlatform); $setSql[] = $adapterPlatform->quoteIdentifier($column) . ' = ' . $exprData->getSql(); } elseif (is_null($value)) { $setSql[] = $adapterPlatform->quoteIdentifier($column) . ' = NULL'; } else { $setSql[] = $adapterPlatform->quoteIdentifier($column) . ' = ' . $adapterPlatform->quoteValue($value); } } $set = implode(', ', $setSql); } $sql = sprintf($this->specifications[self::SPECIFICATION_UPDATE], $table, $set); if ($this->where->count() > 0) { $whereParts = $this->processExpression($this->where, $adapterPlatform, null, 'where'); $sql .= ' ' . sprintf($this->specifications[self::SPECIFICATION_WHERE], $whereParts->getSql()); } return $sql; }
protected function processWhere(PlatformInterface $platform, Adapter $adapter = null, ParameterContainer $parameterContainer = null) { if ($this->where->count() == 0) { return null; } $whereParts = $this->processExpression($this->where, $platform, $adapter, $this->processInfo['paramPrefix'] . 'where'); if ($parameterContainer) { $parameterContainer->merge($whereParts->getParameterContainer()); } return array($whereParts->getSql()); }
protected function processWhere(PlatformInterface $platform, Adapter $adapter = null, ParameterContainer $parameterContainer = null) { if ($this->where->count() == 0) { return null; } $whereParts = $this->processExpression($this->where, $platform, $adapter ? $adapter->getDriver() : null, 'where'); if (count($whereParts['parameters']) > 0) { $parameterContainer->merge($whereParts['parameters']); } return array($whereParts['sql']); }
/** * Get the SQL string, based on the platform * * Platform defaults to Sql92 if none provided * * @param null|PlatformInterface $adapterPlatform * @return string */ public function getSqlString(PlatformInterface $adapterPlatform = null) { $adapterPlatform = $adapterPlatform ?: new Sql92(); $table = $adapterPlatform->quoteIdentifier($this->table); // if ($this->schema != '') { // $table = $platform->quoteIdentifier($this->schema) . $platform->getIdentifierSeparator() . $table; // } $sql = sprintf($this->specifications[self::SPECIFICATION_DELETE], $table); if ($this->where->count() > 0) { $whereParts = $this->processExpression($this->where, $adapterPlatform, null, 'where'); $sql .= ' ' . sprintf($this->specifications[self::SPECIFICATION_WHERE], $whereParts['sql']); } return $sql; }
/** * Get the SQL string, based on the platform * * Platform defaults to Sql92 if none provided * * @param null|PlatformInterface $adapterPlatform * @return string */ public function getSqlString(PlatformInterface $adapterPlatform = null) { $adapterPlatform = $adapterPlatform ?: new Sql92(); $table = $this->table; $schema = null; // create quoted table name to use in delete processing if ($table instanceof TableIdentifier) { list($table, $schema) = $table->getTableAndSchema(); } $table = $adapterPlatform->quoteIdentifier($table); if ($schema) { $table = $adapterPlatform->quoteIdentifier($schema) . $adapterPlatform->getIdentifierSeparator() . $table; } $sql = sprintf($this->specifications[static::SPECIFICATION_DELETE], $table); if ($this->where->count() > 0) { $whereParts = $this->processExpression($this->where, $adapterPlatform, null, 'where'); $sql .= ' ' . sprintf($this->specifications[static::SPECIFICATION_WHERE], $whereParts->getSql()); } return $sql; }
/** * Get SQL string for statement * * @param null|PlatformInterface $adapterPlatform If null, defaults to Sql92 * @return string */ public function getSqlString(PlatformInterface $adapterPlatform = null) { $adapterPlatform = ($adapterPlatform) ?: new Sql92; $table = $adapterPlatform->quoteIdentifier($this->table); $set = $this->set; if (is_array($set)) { $setSql = array(); foreach ($set as $setName => $setValue) { $setSql[] = $adapterPlatform->quoteIdentifier($setName) . ' = ' . $adapterPlatform->quoteValue($setValue); } $set = implode(', ', $setSql); } $sql = sprintf($this->specifications[self::SPECIFICATION_UPDATE], $table, $set); if ($this->where->count() > 0) { $whereParts = $this->processExpression($this->where, $adapterPlatform, null, 'where'); $sql .= ' ' . sprintf($this->specifications[self::SPECIFICATION_WHERE], $whereParts['sql']); } return $sql; }