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


PHP DatabaseConnection::databaseType方法代码示例

本文整理汇总了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;
 }
开发者ID:Briareos,项目名称:Oxygen,代码行数:30,代码来源:AttachStateListener.php

示例2: databaseType

 public function databaseType()
 {
     return $this->connection->databaseType();
 }
开发者ID:akapivo,项目名称:www.dmi.be,代码行数:4,代码来源:Connection.php


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