@@ -99,8 +99,11 @@ abstract class AbstractDb extends \Magento\Framework\Data\Collection
99
99
*/
100
100
protected $ extensionAttributesJoinProcessor ;
101
101
102
- /** @see https://en.wikipedia.org/wiki/List_of_SQL_reserved_words */
103
- private const SQL_RESERVED_WORDS = [
102
+ /**
103
+ * @see https://en.wikipedia.org/wiki/List_of_SQL_reserved_words
104
+ * @var array
105
+ */
106
+ private array $ sqlReservedWords = [
104
107
'ABORT ' , 'ABORTSESSION ' , 'ABS ' , 'ABSENT ' , 'ABSOLUTE ' , 'ACCESS ' ,
105
108
'ACCESS_LOCK ' , 'ACCESSIBLE ' , 'ACCOUNT ' , 'ACOS ' , 'ACOSH ' , 'ACTION ' ,
106
109
'ADD ' , 'ADD_MONTHS ' , 'ADMIN ' , 'AFTER ' , 'AGGREGATE ' , 'ALIAS ' , 'ALL ' ,
@@ -278,6 +281,7 @@ public function __construct(
278
281
$ this ->setConnection ($ connection );
279
282
}
280
283
$ this ->_logger = $ logger ;
284
+ $ this ->sqlReservedWords = array_flip ($ this ->sqlReservedWords );
281
285
}
282
286
283
287
/**
@@ -666,7 +670,7 @@ protected function _renderOrders()
666
670
{
667
671
if (!$ this ->_isOrdersRendered ) {
668
672
foreach ($ this ->_orders as $ field => $ direction ) {
669
- if (in_array ( strtoupper ($ field ), self :: SQL_RESERVED_WORDS )) {
673
+ if (isset ( $ this -> sqlReservedWords [ strtoupper ($ field )] )) {
670
674
$ field = "` $ field` " ;
671
675
}
672
676
$ this ->_select ->order (new \Zend_Db_Expr ($ field . ' ' . $ direction ));
0 commit comments