本文整理汇总了PHP中Doctrine\DBAL\Schema\Column::getQuotedName方法的典型用法代码示例。如果您正苦于以下问题:PHP Column::getQuotedName方法的具体用法?PHP Column::getQuotedName怎么用?PHP Column::getQuotedName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Schema\Column
的用法示例。
在下文中一共展示了Column::getQuotedName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testQuotedColumnName
/**
* @group DBAL-64
*/
public function testQuotedColumnName()
{
$string = Type::getType('string');
$column = new Column("`bar`", $string, array());
$mysqlPlatform = new \Doctrine\DBAL\Platforms\MySqlPlatform();
$sqlitePlatform = new \Doctrine\DBAL\Platforms\SqlitePlatform();
$this->assertEquals('bar', $column->getName());
$this->assertEquals('`bar`', $column->getQuotedName($mysqlPlatform));
$this->assertEquals('"bar"', $column->getQuotedName($sqlitePlatform));
}
示例2: getSql
public function getSql(Column $column, $table)
{
if (!$table instanceof Table) {
$table = new Identifier($table);
}
$sql = array();
$normalized = $column->getType()->getNormalizedPostGISColumnOptions($column->getCustomSchemaOptions());
$srid = $normalized['srid'];
// PostGIS 1.5 uses -1 for undefined SRID's
if ($srid <= 0) {
$srid = -1;
}
$type = strtoupper($normalized['geometry_type']);
if ('ZM' === substr($type, -2)) {
$dimension = 4;
$type = substr($type, 0, -2);
} elseif ('M' === substr($type, -1)) {
$dimension = 3;
} elseif ('Z' === substr($type, -1)) {
$dimension = 3;
$type = substr($type, 0, -1);
} else {
$dimension = 2;
}
// Geometry columns are created by the AddGeometryColumn stored procedure
$sql[] = sprintf("SELECT AddGeometryColumn('%s', '%s', %d, '%s', %d)", $table->getName(), $column->getName(), $srid, $type, $dimension);
if ($column->getNotnull()) {
// Add a NOT NULL constraint to the field
$sql[] = sprintf('ALTER TABLE %s ALTER %s SET NOT NULL', $table->getQuotedName($this->platform), $column->getQuotedName($this->platform));
}
return $sql;
}
示例3: getAlterTableRenameColumnClause
/**
* Returns the SQL clause for renaming a column in a table alteration.
*
* @param string $oldColumnName The quoted name of the column to rename.
* @param Column $column The column to rename to.
*
* @return string
*/
protected function getAlterTableRenameColumnClause($oldColumnName, Column $column)
{
$oldColumnName = new Identifier($oldColumnName);
return 'RENAME ' . $oldColumnName->getQuotedName($this) . ' TO ' . $column->getQuotedName($this);
}
示例4: getAlterTableAddDefaultConstraintClause
/**
* Returns the SQL clause for adding a default constraint in an ALTER TABLE statement.
*
* @param string $tableName The name of the table to generate the clause for.
* @param Column $column The column to generate the clause for.
*
* @return string
*/
private function getAlterTableAddDefaultConstraintClause($tableName, Column $column)
{
$columnDef = $column->toArray();
$columnDef['name'] = $column->getQuotedName($this);
return 'ADD' . $this->getDefaultConstraintDeclarationSQL($tableName, $columnDef);
}
示例5: getAlterTableRenameColumnClause
/**
* Returns the SQL clause for renaming a column in a table alteration.
*
* @param string $oldColumnName The quoted name of the column to rename.
* @param Column $column The column to rename to.
*
* @return string
*/
protected function getAlterTableRenameColumnClause($oldColumnName, Column $column)
{
return 'RENAME ' . $oldColumnName . ' TO ' . $column->getQuotedName($this);
}
示例6: prepareColumnData
/**
* @param \Doctrine\DBAL\Schema\Column $column The name of the table.
* @param array $primaries
*
* @return array The column data as associative array.
*/
public function prepareColumnData($column, $primaries = array())
{
$columnData = array();
$columnData['name'] = $column->getQuotedName($this);
$columnData['type'] = $column->getType();
$columnData['length'] = $column->getLength();
$columnData['notnull'] = $column->getNotNull();
$columnData['fixed'] = $column->getFixed();
$columnData['unique'] = false;
// TODO: what do we do about this?
$columnData['version'] = $column->hasPlatformOption("version") ? $column->getPlatformOption('version') : false;
if (strtolower($columnData['type']) == "string" && $columnData['length'] === null) {
$columnData['length'] = 255;
}
$columnData['unsigned'] = $column->getUnsigned();
$columnData['precision'] = $column->getPrecision();
$columnData['scale'] = $column->getScale();
$columnData['default'] = $column->getDefault();
$columnData['columnDefinition'] = $column->getColumnDefinition();
$columnData['autoincrement'] = $column->getAutoincrement();
$columnData['comment'] = $this->getColumnComment($column);
$columnData['platformOptions'] = $column->getPlatformOptions();
if (in_array($column->getName(), $primaries)) {
$columnData['primary'] = true;
}
return $columnData;
}
示例7: getRenameColumnSQL
/**
* Gets the SQL to rename a column.
*
* @param string table that contains the column
* @param string old column name
* @param Column new column
*/
protected function getRenameColumnSQL($tableName, $oldName, Column $column)
{
return 'RENAME COLUMN ' . $tableName . '.' . $oldName . ' TO ' . $column->getQuotedName($this);
}