Skip to content

Commit 824f815

Browse files
committed
[TASK] Update symfony fix (query issue)
1 parent ff55a19 commit 824f815

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

lib/vendor/creole/drivers/mssqlsrv/MSSQLSRVPreparedStatement.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,26 @@ public function executeQuery($p1 = null, $fetchmode = null)
7878
$this->updateCount = null; // reset
7979
$sql = $this->replaceParams();
8080

81-
if ($this->limit > 0 || $this->offset > 0) {
82-
$this->conn->applyLimit($sql, $this->offset, $this->limit);
81+
if(stripos($sql, 'ORDER BY'))
82+
$offsetBefore = true;
83+
else
84+
$offsetBefore = false;
85+
86+
if($offsetBefore)
87+
{
88+
if ($this->limit > 0 || $this->offset > 0) {
89+
$this->conn->applyLimit($sql, $this->offset, $this->limit);
90+
}
8391
}
8492

8593
$this->resultSet = $this->conn->executeQuery($sql, $fetchmode);
94+
95+
if(!$offsetBefore)
96+
{
97+
$this->resultSet->_setOffset($this->offset);
98+
$this->resultSet->_setLimit($this->limit);
99+
}
100+
86101
return $this->resultSet;
87102
}
88103

0 commit comments

Comments
 (0)