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


PHP Collation::getCharacterSet方法代码示例

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


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

示例1: testGetCharset

 /**
  * Tests to get character set name from collation name.
  */
 public function testGetCharset()
 {
     // Get Charset for utf8_unicode_ci
     $this->assertEquals('utf8', Collation::getCharacterSet('utf8_unicode_ci'));
 }
开发者ID:cebe,项目名称:chive,代码行数:8,代码来源:CollationTest.php

示例2: getSaveDefinition

 /**
  * Returns the query string for all options which need to be saved.
  *
  * @return	string
  */
 private function getSaveDefinition()
 {
     $sql = '';
     $comma = '';
     if ($this->TABLE_NAME !== @$this->originalAttributes['TABLE_NAME'] && !$this->getIsNewRecord()) {
         //@todo(mburtscher): Privileges are not copied automatically!!!
         $sql .= "\n\t" . 'RENAME ' . self::$db->quoteTableName($this->TABLE_NAME);
         $comma = ',';
     }
     if ($this->TABLE_COLLATION !== @$this->originalAttributes['TABLE_COLLATION']) {
         $sql .= $comma . "\n\t" . 'CHARACTER SET ' . Collation::getCharacterSet($this->TABLE_COLLATION) . ' COLLATE ' . $this->TABLE_COLLATION;
         $comma = ',';
     }
     if ($this->comment !== @$this->originalAttributes['comment']) {
         $sql .= $comma . "\n\t" . 'COMMENT ' . self::$db->quoteValue($this->comment);
         $comma = ',';
     }
     if ($this->ENGINE !== @$this->originalAttributes['ENGINE']) {
         $sql .= $comma . "\n\t" . 'ENGINE ' . $this->ENGINE;
         $comma = ',';
     }
     if ($this->optionChecksum !== $this->originalOptionChecksum) {
         $sql .= $comma . "\n\t" . 'CHECKSUM ' . $this->optionChecksum;
         $comma = ',';
     }
     if ($this->optionPackKeys !== $this->originalOptionPackKeys) {
         $sql .= $comma . "\n\t" . 'PACK_KEYS ' . $this->optionPackKeys;
         $comma = ',';
     }
     if ($this->optionDelayKeyWrite !== $this->originalOptionDelayKeyWrite) {
         $sql .= $comma . "\n\t" . 'DELAY_KEY_WRITE ' . $this->optionDelayKeyWrite;
     }
     return $sql;
 }
开发者ID:cebe,项目名称:chive,代码行数:39,代码来源:Table.php

示例3: getColumnDefinition

 public function getColumnDefinition()
 {
     if (DataType::check($this->DATA_TYPE, DataType::SUPPORTS_COLLATION)) {
         $collate = ' CHARACTER SET ' . Collation::getCharacterSet($this->COLLATION_NAME) . ' COLLATE ' . $this->COLLATION_NAME;
     } else {
         $collate = '';
     }
     if ($this->attribute) {
         if ($this->attribute == 'unsigned' && DataType::check($this->DATA_TYPE, DataType::SUPPORTS_UNSIGNED) || $this->attribute == 'unsigned zerofill' && DataType::check($this->DATA_TYPE, DataType::SUPPORTS_UNSIGNED_ZEROFILL) || $this->attribute == 'on update current_timestamp' && DataType::check($this->DATA_TYPE, DataType::SUPPORTS_ON_UPDATE_CURRENT_TIMESTAMP)) {
             $attribute = ' ' . $this->attribute;
         } else {
             $attribute = '';
         }
     } else {
         $attribute = '';
     }
     if (strlen($this->COLUMN_DEFAULT) > 0 && $this->EXTRA != 'auto_increment') {
         if ($this->DATA_TYPE == 'timestamp' && strtolower($this->COLUMN_DEFAULT) == 'current_timestamp') {
             $defaultValue = 'CURRENT_TIMESTAMP';
         } elseif ($this->DATA_TYPE == 'bit') {
             if (preg_match('/b\'[01]+\'/', $this->COLUMN_DEFAULT)) {
                 $defaultValue = $this->COLUMN_DEFAULT;
             } else {
                 $defaultValue = 'b' . self::$db->quoteValue($this->COLUMN_DEFAULT);
             }
         } else {
             $defaultValue = self::$db->quoteValue($this->COLUMN_DEFAULT);
         }
         $default = ' DEFAULT ' . $defaultValue;
     } else {
         if ($this->getIsNullable() && $this->EXTRA != 'auto_increment') {
             $default = ' DEFAULT NULL';
         } else {
             $default = '';
         }
     }
     return trim(self::$db->quoteColumnName($this->COLUMN_NAME) . ' ' . $this->getColumnType() . $attribute . $collate . ($this->getIsNullable() ? ' NULL' : ' NOT NULL') . $default . ($this->EXTRA == 'auto_increment' ? ' AUTO_INCREMENT' : '') . ($this->createPrimaryKey ? ' PRIMARY KEY' : '') . ($this->createUniqueKey ? ' UNIQUE KEY' : '') . (strlen($this->COLUMN_COMMENT) ? ' COMMENT ' . self::$db->quoteValue($this->COLUMN_COMMENT) : ''));
 }
开发者ID:cebe,项目名称:chive,代码行数:38,代码来源:Column.php


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