소스 검색

* Avoid errors when dataset is not active while constructing update SQL.

git-svn-id: trunk@45189 -
michael 5 년 전
부모
커밋
07e2d4e4c5
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      packages/fcl-db/src/sqldb/sqldb.pp

+ 2 - 1
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 + '"';