From 07e2d4e4c5af45da62a9cd4082cc22b926713ded Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 30 Apr 2020 10:43:03 +0000 Subject: [PATCH] * Avoid errors when dataset is not active while constructing update SQL. git-svn-id: trunk@45189 - --- packages/fcl-db/src/sqldb/sqldb.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/fcl-db/src/sqldb/sqldb.pp b/packages/fcl-db/src/sqldb/sqldb.pp index b69cde538e..af867e6aaf 100644 --- a/packages/fcl-db/src/sqldb/sqldb.pp +++ b/packages/fcl-db/src/sqldb/sqldb.pp @@ -2017,7 +2017,8 @@ begin if (sql_where<>'') then sql_where:=sql_where + ' and '; sql_where:= sql_where + '(' + FieldNameQuoteChars[0] + F.FieldName + FieldNameQuoteChars[1]; - if F.OldValue = NULL then + // primary key normally cannot be null + if Assigned(F.Dataset) and F.Dataset.Active and (F.OldValue = NULL) then sql_where := sql_where + ' is null ' else sql_where := sql_where +'= :"' + 'OLD_' + F.FieldName + '"';