当前位置: 首页>>代码示例>>PHP>>正文


PHP AbstractPlatform::quoteIdentifier方法代码示例

本文整理汇总了PHP中Doctrine\DBAL\Platforms\AbstractPlatform::quoteIdentifier方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractPlatform::quoteIdentifier方法的具体用法?PHP AbstractPlatform::quoteIdentifier怎么用?PHP AbstractPlatform::quoteIdentifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\DBAL\Platforms\AbstractPlatform的用法示例。


在下文中一共展示了AbstractPlatform::quoteIdentifier方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testAlterTableChangeQuotedColumn

 /**
  * @group DBAL-585
  */
 public function testAlterTableChangeQuotedColumn()
 {
     $tableDiff = new \Doctrine\DBAL\Schema\TableDiff('mytable');
     $tableDiff->fromTable = new \Doctrine\DBAL\Schema\Table('mytable');
     $tableDiff->changedColumns['foo'] = new \Doctrine\DBAL\Schema\ColumnDiff('select', new \Doctrine\DBAL\Schema\Column('select', \Doctrine\DBAL\Types\Type::getType('string')), array('type'));
     $this->assertContains($this->_platform->quoteIdentifier('select'), implode(';', $this->_platform->getAlterTableSQL($tableDiff)));
 }
开发者ID:pnaq57,项目名称:zf2demo,代码行数:10,代码来源:AbstractPlatformTestCase.php

示例2: getDiscriminatorColumn

 private function getDiscriminatorColumn(ClassMetadata $meta)
 {
     if (!$meta->isInheritanceTypeSingleTable()) {
         return [];
     }
     $column = $meta->discriminatorColumn;
     return [$column['fieldName'] => ['value' => $meta->discriminatorValue, 'quotedColumn' => $this->platform->quoteIdentifier($column['name']), 'type' => Type::getType($column['type'])]];
 }
开发者ID:BianoCZ,项目名称:Doctrine,代码行数:8,代码来源:NonLockingUniqueInserter.php

示例3: loadIndex

 /**
  * @param \Doctrine\DBAL\Schema\Table $table
  * @param \SimpleXMLElement $xml
  * @throws \DomainException
  */
 private function loadIndex($table, $xml)
 {
     $name = null;
     $fields = array();
     foreach ($xml->children() as $child) {
         /**
          * @var \SimpleXMLElement $child
          */
         switch ($child->getName()) {
             case 'name':
                 $name = (string) $child;
                 break;
             case 'primary':
                 $primary = $this->asBool($child);
                 break;
             case 'unique':
                 $unique = $this->asBool($child);
                 break;
             case 'field':
                 foreach ($child->children() as $field) {
                     /**
                      * @var \SimpleXMLElement $field
                      */
                     switch ($field->getName()) {
                         case 'name':
                             $field_name = (string) $field;
                             $field_name = $this->platform->quoteIdentifier($field_name);
                             $fields[] = $field_name;
                             break;
                         case 'sorting':
                             break;
                         default:
                             throw new \DomainException('Unknown element: ' . $field->getName());
                     }
                 }
                 break;
             default:
                 throw new \DomainException('Unknown element: ' . $child->getName());
         }
     }
     if (!empty($fields)) {
         if (isset($primary) && $primary) {
             if ($table->hasPrimaryKey()) {
                 return;
             }
             $table->setPrimaryKey($fields, $name);
         } else {
             if (isset($unique) && $unique) {
                 $table->addUniqueIndex($fields, $name);
             } else {
                 $table->addIndex($fields, $name);
             }
         }
     } else {
         throw new \DomainException('Empty index definition: ' . $name . ' options:' . print_r($fields, true));
     }
 }
开发者ID:loulancn,项目名称:core,代码行数:62,代码来源:mdb2schemareader.php

示例4: getJoinTableName

 /**
  * {@inheritdoc}
  */
 public function getJoinTableName(array $association, ClassMetadata $class, AbstractPlatform $platform)
 {
     $schema = '';
     if (isset($association['joinTable']['schema'])) {
         $schema = $association['joinTable']['schema'] . '.';
     }
     $tableName = $association['joinTable']['name'];
     if (isset($association['joinTable']['quoted'])) {
         $tableName = $platform->quoteIdentifier($tableName);
     }
     return $schema . $tableName;
 }
开发者ID:Dren-x,项目名称:mobitnew,代码行数:15,代码来源:DefaultQuoteStrategy.php

示例5: quoteIdentifier

 /**
  * Quotes a string so it can be safely used as a table or column name, even if
  * it is a reserved name.
  *
  * Delimiting style depends on the underlying database platform that is being used.
  *
  * NOTE: Just because you CAN use quoted identifiers does not mean
  * you SHOULD use them. In general, they end up causing way more
  * problems than they solve.
  *
  * @param string $str The name to be quoted.
  *
  * @return string The quoted name.
  */
 public function quoteIdentifier($str)
 {
     return $this->_platform->quoteIdentifier($str);
 }
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:18,代码来源:Connection.php

示例6: getJoinTableName

 /**
  * {@inheritdoc}
  */
 public function getJoinTableName(array $association, ClassMetadata $class, AbstractPlatform $platform)
 {
     return isset($association['joinTable']['quoted']) ? $platform->quoteIdentifier($association['joinTable']['name']) : $association['joinTable']['name'];
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:7,代码来源:DefaultQuoteStrategy.php

示例7: getQuotedJoinTableName

 /**
  * Gets the (possibly quoted) name of the join table.
  *
  * @deprecated Deprecated since version 2.3 in favor of \Doctrine\ORM\Mapping\QuoteStrategy
  *
  * @param array $assoc
  * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
  * @return string
  */
 public function getQuotedJoinTableName(array $assoc, $platform)
 {
     return isset($assoc['joinTable']['quoted']) ? $platform->quoteIdentifier($assoc['joinTable']['name']) : $assoc['joinTable']['name'];
 }
开发者ID:alexanderwsp-git,项目名称:columbus,代码行数:13,代码来源:ClassMetadataInfo.php

示例8: getQuotedName

 /**
  * Get the quoted representation of this asset but only if it was defined with one. Otherwise
  * return the plain unquoted value as inserted.
  *
  * @param AbstractPlatform $platform
  * @return string
  */
 public function getQuotedName(AbstractPlatform $platform)
 {
     $keywords = $platform->getReservedKeywordsList();
     $parts = explode(".", $this->getName());
     foreach ($parts as $k => $v) {
         $parts[$k] = $this->_quoted || $keywords->isKeyword($v) ? $platform->quoteIdentifier($v) : $v;
     }
     return implode(".", $parts);
 }
开发者ID:pollux1er,项目名称:dlawebdev2,代码行数:16,代码来源:AbstractAsset.php

示例9: getQuotedName

 /**
  * Get the quoted representation of this asset but only if it was defined with one. Otherwise
  * return the plain unquoted value as inserted.
  *
  * @param AbstractPlatform $platform
  * @return string
  */
 public function getQuotedName(AbstractPlatform $platform)
 {
     return $this->_quoted ? $platform->quoteIdentifier($this->_name) : $this->_name;
 }
开发者ID:michaelnavarro,项目名称:zc,代码行数:11,代码来源:AbstractAsset.php

示例10: createForeignKeyReplacement

 /**
  * Creates a foreign index replacement, which has quoted column names.
  *
  * @param ForeignKeyConstraint $fk
  *
  * @return ForeignKeyConstraint
  */
 private function createForeignKeyReplacement(ForeignKeyConstraint $fk)
 {
     return new ForeignKeyConstraint($this->quoteIdentifiers($fk->getLocalColumns()), $this->platform->quoteIdentifier($fk->getForeignTableName()), $this->quoteIdentifiers($fk->getForeignColumns()), $this->platform->quoteIdentifier($fk->getName()), $fk->getOptions());
 }
开发者ID:digilist,项目名称:snakedumper,代码行数:11,代码来源:IdentifierQuoter.php


注:本文中的Doctrine\DBAL\Platforms\AbstractPlatform::quoteIdentifier方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。