Browse Source

Fixes #17348: Improved performance of `yii\db\Connection::quoteTableName()`

tags/2.0.21
Brandon Kelly 5 years ago committed by Alexander Makarov
parent
commit
b638cc4a4e
  1. 1
      framework/CHANGELOG.md
  2. 9
      framework/db/Connection.php

1
framework/CHANGELOG.md

@ -6,6 +6,7 @@ Yii Framework 2 Change Log
- Bug #17341: Fixed error from yii.activeForm.js in strict mode (mikehaertl)
- Enh #17345: Improved performance of `yii\db\Connection::quoteColumnName()` (brandonkelly)
- Enh #17348: Improved performance of `yii\db\Connection::quoteTableName()` (brandonkelly)
2.0.20 June 04, 2019

9
framework/db/Connection.php

@ -442,6 +442,10 @@ class Connection extends Component
*/
private $_queryCacheInfo = [];
/**
* @var string[] quoted table name cache for [[quoteTableName()]] calls
*/
private $_quotedTableNames;
/**
* @var string[] quoted column name cache for [[quoteColumnName()]] calls
*/
private $_quotedColumnNames;
@ -895,7 +899,10 @@ class Connection extends Component
*/
public function quoteTableName($name)
{
return $this->getSchema()->quoteTableName($name);
if (isset($this->_quotedTableNames[$name])) {
return $this->_quotedTableNames[$name];
}
return $this->_quotedTableNames[$name] = $this->getSchema()->quoteTableName($name);
}
/**

Loading…
Cancel
Save