本文整理汇总了PHP中Zend\Db\Adapter\Platform\PlatformInterface::quoteIdentifier方法的典型用法代码示例。如果您正苦于以下问题:PHP PlatformInterface::quoteIdentifier方法的具体用法?PHP PlatformInterface::quoteIdentifier怎么用?PHP PlatformInterface::quoteIdentifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Db\Adapter\Platform\PlatformInterface
的用法示例。
在下文中一共展示了PlatformInterface::quoteIdentifier方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processTable
/**
* @param PlatformInterface $adapterPlatform
* @return array
*/
protected function processTable(PlatformInterface $adapterPlatform = null)
{
$ret = array('');
if ($this->isTemporary) {
$table = '#';
} else {
$table = '';
}
$ret[] = $adapterPlatform->quoteIdentifier($table . ltrim($this->table, '#'));
return $ret;
}
示例2: processChangeColumns
protected function processChangeColumns(PlatformInterface $adapterPlatform = null)
{
/* @var Column\Column $column */
$sqls = [];
foreach ($this->changeColumns as $name => $column) {
if ($name !== $column->getName()) {
trigger_error('One statement must rename a column, other separate statements must change table definition.', E_USER_DEPRECATED);
}
$default = $column->getDefault();
$columnClass = get_class($column);
$emptyColumn = new $columnClass(null, true);
$emptyColumn->setOptions($column->getOptions());
$sqls[] = [$adapterPlatform->quoteIdentifier($name), ' SET DATA TYPE' . $this->processExpression($emptyColumn, $adapterPlatform)];
$sqls[] = [$adapterPlatform->quoteIdentifier($name), null !== $default ? ' SET ' . $this->processExpression(new DefaultValue($default), $adapterPlatform) : ' DROP DEFAULT'];
$sqls[] = [$adapterPlatform->quoteIdentifier($name), $column->isNullable() ? ' DROP NOT NULL' : ' SET NOT NULL'];
}
return [$sqls];
}
示例3: processInsert
protected function processInsert(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
{
if ($this->select) {
return;
}
if (!$this->columns) {
throw new InvalidArgumentException('values or select should be present');
}
$columns = [];
$values = [];
foreach ($this->columns as $column => $value) {
$columns[] = $platform->quoteIdentifier($column);
foreach ($value as $key => $item) {
/* if (is_scalar($item) && $parameterContainer) {
$values[$key][] = $driver->formatParameterName($column);
$parameterContainer->offsetSet($column, $item);
} else {*/
$values[$key][] = $this->resolveColumnValue($item, $platform, $driver, $parameterContainer);
/* }*/
}
}
$strValues = '';
foreach ($values as $value) {
$strValues .= '(' . implode(', ', $value) . '),';
}
$strValues = rtrim($strValues, ',');
$sql = sprintf($this->specifications[static::SPECIFICATION_INSERT], $this->resolveTable($this->table, $platform, $driver, $parameterContainer), implode(', ', $columns), $strValues);
return $sql;
}
示例4: processTable
/**
* @param PlatformInterface $adapterPlatform
*
* @return string[]
*/
protected function processTable(PlatformInterface $adapterPlatform = null)
{
return array($this->isTemporary ? 'TEMPORARY ' : '', $adapterPlatform->quoteIdentifier($this->table));
}
示例5: processTable
protected function processTable(PlatformInterface $adapterPlatform = null)
{
return array($adapterPlatform->quoteIdentifier($this->table));
}
示例6: processJoins
protected function processJoins(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
{
if (!$this->joins) {
return null;
}
// process joins
$joinSpecArgArray = array();
foreach ($this->joins as $j => $join) {
$joinSpecArgArray[$j] = array();
$joinName = null;
$joinAs = null;
// type
$joinSpecArgArray[$j][] = strtoupper($join['type']);
// table name
if (is_array($join['name'])) {
$joinName = current($join['name']);
$joinAs = $platform->quoteIdentifier(key($join['name']));
} else {
$joinName = $join['name'];
}
if ($joinName instanceof TableIdentifier) {
$joinName = $joinName->getTableAndSchema();
$joinName = $platform->quoteIdentifier($joinName[1]) . $platform->getIdentifierSeparator() . $platform->quoteIdentifier($joinName[0]);
} else {
if ($joinName instanceof Select) {
$joinName = '(' . $joinName->processSubSelect($joinName, $platform, $driver, $parameterContainer) . ')';
} else {
$joinName = $platform->quoteIdentifier($joinName);
}
}
$joinSpecArgArray[$j][] = isset($joinAs) ? $joinName . ' AS ' . $joinAs : $joinName;
// on expression
// note: for Expression objects, pass them to processExpression with a prefix specific to each join (used for named parameters)
$joinSpecArgArray[$j][] = $join['on'] instanceof ExpressionInterface ? $this->processExpression($join['on'], $platform, $driver, $this->processInfo['paramPrefix'] . 'join' . ($j + 1) . 'part') : $platform->quoteIdentifierInFragment($join['on'], array('=', 'AND', 'OR', '(', ')', 'BETWEEN', '<', '>'));
// on
if ($joinSpecArgArray[$j][2] instanceof StatementContainerInterface) {
if ($parameterContainer) {
$parameterContainer->merge($joinSpecArgArray[$j][2]->getParameterContainer());
}
$joinSpecArgArray[$j][2] = $joinSpecArgArray[$j][2]->getSql();
}
}
return array($joinSpecArgArray);
}
示例7: processTable
/**
* @param PlatformInterface $adapterPlatform
* @return array
*/
protected function processTable(PlatformInterface $adapterPlatform = null)
{
$table = ($this->isTemporary ? '#' : '') . ltrim($this->table, '#');
return ['', $adapterPlatform->quoteIdentifier($table)];
}
示例8: processDropConstraints
protected function processDropConstraints(PlatformInterface $adapterPlatform = null)
{
$sqls = array();
foreach ($this->dropConstraints as $constraint) {
$sqls[] = $adapterPlatform->quoteIdentifier($constraint);
}
return array($sqls);
}
示例9: processOrder
protected function processOrder(PlatformInterface $platform, Adapter $adapter = null, ParameterContainer $parameterContainer = null)
{
if (empty($this->order)) {
return null;
}
$orders = array();
foreach ($this->order as $k => $v) {
if (is_int($k)) {
if (strpos($v, ' ') !== false) {
list($k, $v) = preg_split('# #', $v, 2);
} else {
$k = $v;
$v = self::ORDER_ASCENDING;
}
}
if (strtoupper($v) == self::ORDER_DESENDING) {
$orders[] = array($platform->quoteIdentifier($k), self::ORDER_DESENDING);
} else {
$orders[] = array($platform->quoteIdentifier($k), self::ORDER_ASCENDING);
}
}
return array($orders);
}
示例10: processUpdate
protected function processUpdate(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
{
$setSql = [];
foreach ($this->set as $column => $value) {
$prefix = $platform->quoteIdentifier($column) . ' = ';
if (is_scalar($value) && $parameterContainer) {
$setSql[] = $prefix . $driver->formatParameterName($column);
$parameterContainer->offsetSet($column, $value);
} else {
$setSql[] = $prefix . $this->resolveColumnValue($value, $platform, $driver, $parameterContainer);
}
}
return sprintf($this->specifications[static::SPECIFICATION_UPDATE], $this->resolveTable($this->table, $platform, $driver, $parameterContainer), implode(', ', $setSql));
}
示例11: processJoin
protected function processJoin(PlatformInterface $platform, Adapter $adapter = null, ParameterContainer $parameterContainer = null)
{
if (!$this->joins) {
return null;
}
// process joins
$joinSpecArgArray = array();
foreach ($this->joins as $j => $join) {
if (is_array($join['name'])) {
$keys = array_keys($join['name']);
$alias = array_pop($keys);
$name = $join['name'][$alias];
$nameArg = $platform->quoteIdentifier($name) . ' AS ' . $platform->quoteIdentifier($alias);
} else {
$nameArg = $platform->quoteIdentifier($join['name']);
}
$joinSpecArgArray[$j] = array();
$joinSpecArgArray[$j][] = strtoupper($join['type']);
// type
$joinSpecArgArray[$j][] = $nameArg;
// table
$joinSpecArgArray[$j][] = $platform->quoteIdentifierInFragment($join['on'], array('=', 'AND', 'OR', '(', ')', 'BETWEEN'));
// on
}
return array($joinSpecArgArray);
}
示例12: processTable
protected function processTable(PlatformInterface $adapterPlatform = null)
{
$ret = array();
if ($this->isTemporary) {
$ret[] = 'TEMPORARY';
}
$ret[] = $adapterPlatform->quoteIdentifier($this->table);
return $ret;
}
示例13: processRenameColumn
protected function processRenameColumn(PlatformInterface $adapterPlatform = null)
{
$sqls = [];
foreach ($this->renameColumn as $name => $column) {
$sqls[] = [$adapterPlatform->quoteIdentifier($name), $this->processExpression($column, $adapterPlatform)];
}
return [$sqls];
}
示例14: processJoins
protected function processJoins(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
{
if (!$this->joins) {
return;
}
// process joins
$joinSpecArgArray = [];
foreach ($this->joins as $j => $join) {
$joinName = null;
$joinAs = null;
// table name
if (is_array($join['name'])) {
$joinName = current($join['name']);
$joinAs = $platform->quoteIdentifier(key($join['name']));
} else {
$joinName = $join['name'];
}
if ($joinName instanceof Expression) {
$joinName = $joinName->getExpression();
} elseif ($joinName instanceof TableIdentifier) {
$joinName = $joinName->getTableAndSchema();
$joinName = ($joinName[1] ? $platform->quoteIdentifier($joinName[1]) . $platform->getIdentifierSeparator() : '') . $platform->quoteIdentifier($joinName[0]);
} elseif ($joinName instanceof Select) {
$joinName = '(' . $this->processSubSelect($joinName, $platform, $driver, $parameterContainer) . ')';
} elseif (is_string($joinName) || is_object($joinName) && is_callable([$joinName, '__toString'])) {
$joinName = $platform->quoteIdentifier($joinName);
} else {
throw new Exception\InvalidArgumentException(sprintf('Join name expected to be Expression|TableIdentifier|Select|string, "%s" given', gettype($joinName)));
}
$joinSpecArgArray[$j] = [strtoupper($join['type']), $this->renderTable($joinName, $joinAs)];
// on expression
// note: for Expression objects, pass them to processExpression with a prefix specific to each join (used for named parameters)
$joinSpecArgArray[$j][] = $join['on'] instanceof ExpressionInterface ? $this->processExpression($join['on'], $platform, $driver, $parameterContainer, 'join' . ($j + 1) . 'part') : $platform->quoteIdentifierInFragment($join['on'], ['=', 'AND', 'OR', '(', ')', 'BETWEEN', '<', '>']);
// on
}
return [$joinSpecArgArray];
}
示例15: processInsert
protected function processInsert(PlatformInterface $platform, DriverInterface $driver = null, ParameterContainer $parameterContainer = null)
{
if ($this->select) {
return;
}
if (!$this->columns) {
throw new Exception\InvalidArgumentException('values or select should be present');
}
$columns = [];
$values = [];
foreach ($this->columns as $column => $value) {
$columns[] = $platform->quoteIdentifier($column);
if (is_scalar($value) && $parameterContainer) {
$values[] = $driver->formatParameterName($column);
$parameterContainer->offsetSet($column, $value);
} else {
$values[] = $this->resolveColumnValue($value, $platform, $driver, $parameterContainer);
}
}
return sprintf($this->specifications[static::SPECIFICATION_INSERT], $this->resolveTable($this->table, $platform, $driver, $parameterContainer), implode(', ', $columns), implode(', ', $values));
}