mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
Backwards compatibility and formatting fix for #17897
This commit is contained in:
@ -1190,7 +1190,7 @@ class Command extends Component
|
||||
* @return array the cache key
|
||||
* @since 2.0.16
|
||||
*/
|
||||
protected function getCacheKey($method, $fetchMode)
|
||||
protected function getCacheKey($method, $fetchMode, $rawSql)
|
||||
{
|
||||
$params = $this->params;
|
||||
ksort($params);
|
||||
|
@ -391,22 +391,22 @@ class QueryBuilder extends \yii\db\QueryBuilder
|
||||
*/
|
||||
private function supportsFractionalSeconds()
|
||||
{
|
||||
// use cache to prevent open mysql connection
|
||||
// use cache to prevent opening MySQL connection
|
||||
// https://github.com/yiisoft/yii2/issues/13749#issuecomment-481657224
|
||||
$key = [__METHOD__, $this->db->dsn];
|
||||
$cache = null;
|
||||
$schemaCache = ( \Yii::$app && is_string($this->db->schemaCache) ) ? \Yii::$app->get($this->db->schemaCache, false) : $this->db->schemaCache;
|
||||
if ( $this->db->enableSchemaCache && $schemaCache instanceof CacheInterface ) {
|
||||
$schemaCache = (\Yii::$app && is_string($this->db->schemaCache) ? \Yii::$app->get($this->db->schemaCache, false) : $this->db->schemaCache;
|
||||
if ($this->db->enableSchemaCache && $schemaCache instanceof CacheInterface) {
|
||||
$cache = $schemaCache;
|
||||
}
|
||||
$version = $cache ? $cache->get($key) : null;
|
||||
if( !$version ) {
|
||||
if (!$version) {
|
||||
$version = $this->db->getSlavePdo()->getAttribute(\PDO::ATTR_SERVER_VERSION);
|
||||
if( $cache ) {
|
||||
if ($cache) {
|
||||
$cache->set($key, $version, $this->db->schemaCacheDuration);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return version_compare($version, '5.6.4', '>=');
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user