Skip to content

Commit

Permalink
Fixes #17345: Improved performance of `yii\db\Connection::quoteColumn…
Browse files Browse the repository at this point in the history
…Name()`
  • Loading branch information
brandonkelly authored and samdark committed Jun 7, 2019
1 parent 3297f20 commit 60702e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions framework/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,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)


2.0.20 June 04, 2019
Expand Down
9 changes: 8 additions & 1 deletion framework/db/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,10 @@ class Connection extends Component
* @var array query cache parameters for the [[cache()]] calls
*/
private $_queryCacheInfo = [];
/**
* @var string[] quoted column name cache for [[quoteColumnName()]] calls
*/
private $_quotedColumnNames;


/**
Expand Down Expand Up @@ -904,7 +908,10 @@ public function quoteTableName($name)
*/
public function quoteColumnName($name)
{
return $this->getSchema()->quoteColumnName($name);
if (isset($this->_quotedColumnNames[$name])) {
return $this->_quotedColumnNames[$name];
}
return $this->_quotedColumnNames[$name] = $this->getSchema()->quoteColumnName($name);
}

/**
Expand Down

0 comments on commit 60702e6

Please sign in to comment.