Commit 5fd1ef97 authored by Marcin Haba's avatar Marcin Haba
Browse files

baculum: Add patch for offset parameter support in SQL queries

parent ead6c5b4
From ed58d6bc276f5a3e1302d53f5fbc830b9816f8c1 Mon Sep 17 00:00:00 2001
From: Marcin Haba <marcin.haba@bacula.pl>
Date: Fri, 9 Dec 2022 13:30:34 +0100
Subject: [PATCH] baculum: Fix OFFSET parameter in PHP framework
Ticket in the PRADO framework GitHub project:
Support for OFFSET parameter without LIMIT clause in SQL query for TActiveRecord
https://github.com/pradosoft/prado/issues/819
---
.../pradosoft/prado/framework/Data/DataGateway/TSqlCriteria.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gui/baculum/protected/vendor/pradosoft/prado/framework/Data/DataGateway/TSqlCriteria.php b/gui/baculum/protected/vendor/pradosoft/prado/framework/Data/DataGateway/TSqlCriteria.php
index 4d0acc220d..07a20508a6 100644
--- a/gui/baculum/protected/vendor/pradosoft/prado/framework/Data/DataGateway/TSqlCriteria.php
+++ b/gui/baculum/protected/vendor/pradosoft/prado/framework/Data/DataGateway/TSqlCriteria.php
@@ -144,7 +144,7 @@ class TSqlCriteria extends \Prado\TComponent
// [LIMIT {[offset,] row_count | row_count OFFSET offset}]
// See: http://dev.mysql.com/doc/refman/5.0/en/select.html
- if (preg_match('/ORDER\s+BY\s+(.*?)(?=LIMIT)|ORDER\s+BY\s+(.*?)$/i', $value, $matches) > 0) {
+ if (preg_match('/ORDER\s+BY\s+(.*?)(?=\s+(?:LIMIT|OFFSET))|ORDER\s+BY\s+(.*?)$/i', $value, $matches) > 0) {
// condition contains ORDER BY
$value = str_replace($matches[0], '', $value);
if (strlen($matches[1]) > 0) {
--
2.35.3
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment