本文整理汇总了PHP中Doctrine\DBAL\Schema\Identifier::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Identifier::getName方法的具体用法?PHP Identifier::getName怎么用?PHP Identifier::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Schema\Identifier
的用法示例。
在下文中一共展示了Identifier::getName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: getTableWhereClause
/**
* @param string $table
* @param string $classAlias
* @param string $namespaceAlias
*
* @return string
*/
private function getTableWhereClause($table, $classAlias = 'c', $namespaceAlias = 'n')
{
$whereClause = $namespaceAlias . ".nspname NOT IN ('pg_catalog', 'information_schema', 'pg_toast') AND ";
if (strpos($table, ".") !== false) {
list($schema, $table) = explode(".", $table);
$schema = "'" . $schema . "'";
} else {
$schema = "ANY(string_to_array((select replace(replace(setting,'\"\$user\"',user),' ','') from pg_catalog.pg_settings where name = 'search_path'),','))";
}
$table = new Identifier($table);
$whereClause .= "{$classAlias}.relname = '" . $table->getName() . "' AND {$namespaceAlias}.nspname = {$schema}";
return $whereClause;
}
示例3: generateIdentifierName
/**
* Returns a hash value for a given identifier.
*
* @param string $identifier Identifier to generate a hash value for.
*
* @return string
*/
private function generateIdentifierName($identifier)
{
// Always generate name for unquoted identifiers to ensure consistency.
$identifier = new Identifier($identifier);
return strtoupper(dechex(crc32($identifier->getName())));
}
示例4: getIdentitySequenceName
/**
* {@inheritdoc}
*/
public function getIdentitySequenceName($tableName, $columnName)
{
$table = new Identifier($tableName);
// No usage of column name to preserve BC compatibility with <2.5
$identitySequenceName = $table->getName() . '_SEQ';
if ($table->isQuoted()) {
$identitySequenceName = '"' . $identitySequenceName . '"';
}
$identitySequenceIdentifier = $this->normalizeIdentifier($identitySequenceName);
return $identitySequenceIdentifier->getQuotedName($this);
}
示例5: getUnqualifiedForeignTableName
/**
* Returns the non-schema qualified foreign table name.
*
* @return string
*/
public function getUnqualifiedForeignTableName()
{
$parts = explode(".", $this->_foreignTableName->getName());
return strtolower(end($parts));
}
示例6: getStopDatabaseSQL
/**
* Returns the SQL statement for stopping a running database.
*
* In SQL Anywhere you can start and stop databases on a
* database server instance.
* This is a required statement before dropping an existing database
* as it has to be explicitly stopped before it can be dropped.
*
* @param string $database Name of the database to stop.
*
* @return string
*/
public function getStopDatabaseSQL($database)
{
$database = new Identifier($database);
return 'STOP DATABASE "' . $database->getName() . '" UNCONDITIONALLY';
}
示例7: onSchemaAlterTableChangeColumn
public function onSchemaAlterTableChangeColumn(SchemaAlterTableChangeColumnEventArgs $args)
{
$columnDiff = $args->getColumnDiff();
$column = $columnDiff->column;
if (!$this->isSpatialColumnType($column)) {
return;
}
$diff = $args->getTableDiff();
$table = new Identifier(false !== $diff->newName ? $diff->newName : $diff->name);
if ($columnDiff->hasChanged('type')) {
throw new \RuntimeException('The type of a spatial column cannot be changed (Requested changing type from "' . $columnDiff->fromColumn->getType()->getName() . '" to "' . $column->getType()->getName() . '" for column "' . $column->getName() . '" in table "' . $table->getName() . '")');
}
if ($columnDiff->hasChanged('geometry_type')) {
throw new \RuntimeException('The geometry_type of a spatial column cannot be changed (Requested changing type from "' . strtoupper($columnDiff->fromColumn->getCustomSchemaOption('geometry_type')) . '" to "' . strtoupper($column->getCustomSchemaOption('geometry_type')) . '" for column "' . $column->getName() . '" in table "' . $table->getName() . '")');
}
if ($columnDiff->hasChanged('srid')) {
$args->addSql(sprintf("SELECT UpdateGeometrySRID('%s', '%s', %d)", $table->getName(), $column->getName(), $column->getCustomSchemaOption('srid')));
}
}