RAD Studio Delphi 10.4 Sidney / Interbase And Boolean Field - Serious Bug! - any value stay "false"!

emailx45

Местный
Регистрация
5 Май 2008
Сообщения
3,571
Реакции
2,438
Credits
573
Delphi 10.4 Sidney / Interbase And Boolean Field - Serious Bug! - any value stay "false"!
[SHOWTOGROUPS=4,20,22]
--------------------- workaround for user:

I am currently testing and migrating all my stuff to Delphi Sidney 10.4 (all three patches applied) and found a serious bug regarding the Boolean fields with IBX components (at least these, don't know others for now).

Whenever you change a Boolean field value from false to true and you commit changes.. the value is ALWAYS set to false. I tried many solutions without success, until I found something at Quality Central that fixed the problem (temporary)

You must add the original Data.DB.pas to your project and turn off Code Optimization at Delphi Compiling options, or a better solution is to create a new folder somewhere at your favorite delphi projects sources, copy there the original Data.DB.pas and add this folder at the topmost order of the library path at the delphi options, so this Data.DB.pas version is always found first than the original placed at the Delphi installation folder, and edit the copied Data.DB.pas modifying the Procedure SetAsBoolean of the TBooleanField object. Basically is adding above and below the optimization off and restore of it:

Код:
{$IFOPT O+}
  {$O-}
  {$DEFINE OPTIMIZATIONON}
{$ENDIF}
procedure TBooleanField.SetAsBoolean(Value: Boolean);
var
  B: WordBool;
begin
  if Value then
    Word(B) := 1
  else
    Word(B) := 0;
  if FIOBuffer <> nil then
    TDBBitConverter.UnsafeFrom<WordBool>(B, FIOBuffer);
  SetData(FIOBuffer);
end;
{$IFDEF OPTIMIZATIONON}
  {$O+}
  {$UNDEF OPTIMIZATIONON}
{$ENDIF}

Hope this helps someone.

--------------- another user complete ....
Thank you for your post.

I have been using InterBase 2020 on my projects.

I choose to use InterBase 2020 because it has the Change Views technology that makes the synchronization process of the local database with the remote database and vice versa very fast and easy to implement.

With Change Views you do not need to create triggers (after delete, after insert and after update) for each table of the database and a table to record the changes (inserts, updates and deletes) on each table of the database to do the synchronization of the local and remote databases.
[/SHOWTOGROUPS]
 
Последнее редактирование: