本文整理汇总了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'));
}
示例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;
}
示例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) : ''));
}