當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。