本文整理汇总了PHP中DatabaseConnection::databaseType方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseConnection::databaseType方法的具体用法?PHP DatabaseConnection::databaseType怎么用?PHP DatabaseConnection::databaseType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseConnection
的用法示例。
在下文中一共展示了DatabaseConnection::databaseType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getExtensionChecksum
/**
* Returns a checksum that indicates whether the 'system' table was modified. It is not required to be 100%
* accurate, its goal is to not return the whole 'system' table in the response if the content did not change.
*
* @return string|null 32-character checksum value or NULL if the checksum is not supported.
*/
private function getExtensionChecksum()
{
// There are multiple ways to check when the 'system' table was updated.
if (_cache_get_object('cache_bootstrap') instanceof DrupalDatabaseCache) {
// Every time a "system" change is detected by Drupal, system_list_reset() gets called, which clears the
// 'system_list' cache entry from the 'cache_bootstrap' cache bin. Right here we will check when the cache
// entry was last recreated and use that as the checksum.
$cacheRecreatedAt = $this->connection->query('SELECT created FROM {cache_bootstrap} WHERE cid = :cid', array(':cid' => 'system_list'))->fetchField();
if (ctype_digit((string) $cacheRecreatedAt)) {
// Only rely on this check if we actually get a valid numeric timestamp.
return md5($cacheRecreatedAt);
}
}
if ($this->connection->databaseType() === 'mysql') {
// https://dev.mysql.com/doc/refman/5.0/en/checksum-table.html
$checksum = $this->connection->query('CHECKSUM TABLE {system}')->fetchField(1);
// The columns returned are 'Table' (eg. schema.system) and 'Checksum' (numeric value, eg. 290814144), so
// fetch the second value.
if (ctype_digit((string) $checksum)) {
return md5($checksum);
}
}
return null;
}
示例2: databaseType
public function databaseType()
{
return $this->connection->databaseType();
}