Skip to content

Commit e4517d4

Browse files
committed
Quote alias
1 parent 493913d commit e4517d4

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/Database/Adapter/MariaDB.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,11 +1754,11 @@ public function find(string $collection, array $queries = [], ?int $limit = 25,
17541754
$binds[':cursor'] = $cursor[$originalAttribute];
17551755

17561756
$where[] = "(
1757-
{$defaultAlias}.{$this->quote($attribute)} {$this->getSQLOperator($orderMethod)} :cursor
1757+
{$this->quote($defaultAlias)}.{$this->quote($attribute)} {$this->getSQLOperator($orderMethod)} :cursor
17581758
OR (
1759-
{$defaultAlias}.{$this->quote($attribute)} = :cursor
1759+
{$this->quote($defaultAlias)}.{$this->quote($attribute)} = :cursor
17601760
AND
1761-
{$defaultAlias}._id {$this->getSQLOperator($orderMethodInternalId)} {$cursor['$internalId']}
1761+
{$this->quote($defaultAlias)}._id {$this->getSQLOperator($orderMethodInternalId)} {$cursor['$internalId']}
17621762
)
17631763
)";
17641764
} elseif ($cursorDirection === Database::CURSOR_BEFORE) {
@@ -1937,7 +1937,7 @@ public function count(string $collection, array $queries = [], ?int $max = null)
19371937
$sql = "
19381938
SELECT COUNT(1) as sum FROM (
19391939
SELECT 1
1940-
FROM {$this->getSQLTable($name)} AS {$defaultAlias}
1940+
FROM {$this->getSQLTable($name)} AS {$this->quote($defaultAlias)}
19411941
{$sqlWhere}
19421942
{$limit}
19431943
) table_count
@@ -2011,7 +2011,7 @@ public function sum(string $collection, string $attribute, array $queries = [],
20112011
$sql = "
20122012
SELECT SUM({$this->quote($attribute)}) as sum FROM (
20132013
SELECT {$this->quote($attribute)}
2014-
FROM {$this->getSQLTable($name)} AS {$defaultAlias}
2014+
FROM {$this->getSQLTable($name)} AS {$this->quote($defaultAlias)}
20152015
{$sqlWhere}
20162016
{$limit}
20172017
) table_count

src/Database/Adapter/Postgres.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,11 +1553,11 @@ public function find(string $collection, array $queries = [], ?int $limit = 25,
15531553
$binds[':cursor'] = $cursor[$originalAttribute];
15541554

15551555
$where[] = "(
1556-
{$defaultAlias}.{$this->quote($attribute)} {$this->getSQLOperator($orderMethod)} :cursor
1556+
{$this->quote($defaultAlias)}.{$this->quote($attribute)} {$this->getSQLOperator($orderMethod)} :cursor
15571557
OR (
1558-
{$defaultAlias}.{$this->quote($attribute)} = :cursor
1558+
{$this->quote($defaultAlias)}.{$this->quote($attribute)} = :cursor
15591559
AND
1560-
{$defaultAlias}._id {$this->getSQLOperator($orderMethodInternalId)} {$cursor['$internalId']}
1560+
{$this->quote($defaultAlias)}._id {$this->getSQLOperator($orderMethodInternalId)} {$cursor['$internalId']}
15611561
)
15621562
)";
15631563
} elseif ($cursorDirection === Database::CURSOR_BEFORE) {
@@ -1736,7 +1736,7 @@ public function count(string $collection, array $queries = [], ?int $max = null)
17361736
$sql = "
17371737
SELECT COUNT(1) as sum FROM (
17381738
SELECT 1
1739-
FROM {$this->getSQLTable($name)} AS {$defaultAlias}
1739+
FROM {$this->getSQLTable($name)} AS {$this->quote($defaultAlias)}
17401740
{$sqlWhere}
17411741
{$limit}
17421742
) table_count
@@ -1810,7 +1810,7 @@ public function sum(string $collection, string $attribute, array $queries = [],
18101810
$sql = "
18111811
SELECT SUM({$this->quote($attribute)}) as sum FROM (
18121812
SELECT {$this->quote($attribute)}
1813-
FROM {$this->getSQLTable($name)} AS {$defaultAlias}
1813+
FROM {$this->getSQLTable($name)} AS {$this->quote($defaultAlias)}
18141814
{$sqlWhere}
18151815
{$limit}
18161816
) table_count

0 commit comments

Comments
 (0)