Skip to content

Commit 2cca094

Browse files
committed
[BUGFIX] Limit/Offset done by dbase server - prevent full execution (delays)
1 parent 0cd116a commit 2cca094

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,21 @@ public function createStatement()
120120
}
121121

122122
/**
123-
* Returns false since MSSQL doesn't support this method.
123+
* @see Connection::applyLimit()
124124
*/
125125
public function applyLimit(&$sql, $offset, $limit)
126126
{
127-
return false;
127+
if($limit > 0)
128+
{
129+
$sql .= ' offset ' . ($offset?: 0) . ' rows ';
130+
$sql .= ' fetch next ' . $limit . ' rows only ';
131+
}
132+
else if($offset > 0) {
133+
$sql .= ' offset ' . ($offset?: 0) . ' rows ';
134+
}
128135
}
129136

137+
130138
/**
131139
* @see Connection::close()
132140
*/

0 commit comments

Comments
 (0)