TSQLQuery: ServerFilter causes Access Violation lazarus / 21-General ---------------------------------------------------------------------- Milsa · 2024-07-19 06:30 I have database application for work organization. I set filter to (this show Lazarus during debugging): Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Filter = ANSISTRING($0C0E5F44)^: 'tor.partner_id = 10 AND done = 0' It is ok, filter works. But I add to filter new condition: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Filter = ANSISTRING($0C07C23C)^: 'tor.partner_id = 10 AND tor.product_id = 114 AND done = 0' It doesn't matter in which order I add the conditions, it always crashes if there are 3. Order is set to: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i SELECT  tor.*,  tpr.name AS partner_name,  tp.name AS product_name,  SUM(tpw.hours) AS tpw_sum_hoursFROM [order] torINNER JOIN [partner] tpr ON tpr.id = tor.partner_id AND tpr.hide = 0INNER JOIN [product] tp ON tp.id = tor.product_id AND tp.hide = 0LEFT JOIN [product_work] tpw ON tpw.product_id = tp.id AND tpw.hide = 0WHERE tor.hide = 0 AND tor.done = 0 AND tor.burden = 1GROUP BY tor.idORDER BY serial; Today I try newest version of Lazarus (3.4). The problem persists. ---------------------------------------------------------------------- Milsa · 2024-07-19 06:40 Application crashes in line 2441. ---------------------------------------------------------------------- Milsa · 2024-07-19 06:43 This is structure of my tables: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i CREATE TABLE [order] (    id            INTEGER   PRIMARY KEY AUTOINCREMENT                          NOT NULL,    serial        TEXT (20) NOT NULL                            UNIQUE,    partner_id    INTEGER   NOT NULL                            REFERENCES partner (id),    product_id    INTEGER   NOT NULL                            REFERENCES product (id),    description   TEXT,    priority      INTEGER   NOT NULL,    date_finished DATE,    color         INTEGER   DEFAULT (0)                           NOT NULL,    done          INTEGER   DEFAULT (0)                           NOT NULL,    overtime      INTEGER   DEFAULT (0)                             NOT NULL,    noinsert      INTEGER   NOT NULL                            DEFAULT (0),    burden        INTEGER DEFAULT (0)                             NOT NULL,    hide          INTEGER   DEFAULT (0)                             NOT NULL); Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i CREATE TABLE partner (    id   INTEGER PRIMARY KEY AUTOINCREMENT               NOT NULL,    name TEXT    NOT NULL                 UNIQUE,    hide INTEGER NOT NULL                 DEFAULT (0) ); Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i CREATE TABLE product (    id   INTEGER PRIMARY KEY AUTOINCREMENT               NOT NULL,    name TEXT    NOT NULL                 UNIQUE,    hide INTEGER NOT NULL                 DEFAULT (0) ); ---------------------------------------------------------------------- Milsa · 2024-07-19 06:52 The problem started appearing around Lazarus 2. I didn't notice this problem until then. Maybe it's a bug in the Lazarus code. But I can't confirm this for sure. I would have to try all the older versions of Lazarus one by one ---------------------------------------------------------------------- af0815 · 2024-07-19 08:14 Have you tuned on all debugging capabilities of Lazarus ? Access violation like this are often dangling pointers. You can only go though the code there step by step and look in the watches to find out if the used variables and their content (and pointers) are the same you want to see. ---------------------------------------------------------------------- Zvoni · 2024-07-23 06:24 Is ParseSQL set to False? https://www.freepascal.org/docs- html/fcl/sqldb/tsqlquery.serverfilter.html EDIT: Don't set ServerFiltered to False in Line 2438? From my Link above QuoteIf the dataset is active and ServerFiltered is set to true, then changing this property will re-fetch the data from the server. ---------------------------------------------------------------------- CharlyTango · 2024-07-23 13:17 Firstly, I would check whether the SQL statement you are sending is syntactically and result-wise correct. I would test this with an external programme. As I don't know which operating system you are using, I can't recommend one. And the I'd follow af0815's advice to step-debug your code to see where exactly a problem exists. It would also be interesting to see how exactly you create the SQL statement in the code. Even better would be a small test project against an SQL database so that you can see the problem in real life