dbmemo/dbgrid problem

The offical for ZeosLib 7.3 Report problems, ask for help, post proposals for the new version of Zeoslib 7.3/v8
Quick Info:
-We made two new drivers: odbc(raw and unicode version) and oledb
-GUID domain/field-defined support for FB
-extended error infos of Firebird
-performance ups are still in queue
In future some more feature will arrive, so stay tuned and don't hassitate to help
Post Reply
kjteng
Senior Boarder
Senior Boarder
Posts: 54
Joined: 10.05.2015, 15:02

dbmemo/dbgrid problem

Post by kjteng »

I noticed that changes in dbmemo are not saved when I moved to another record (in dbgrid). This happens if I am using Tzquery/TzMemtable (but not when I am using TMemDataset or Tdbf component).
Attached is the demo file.
You do not have the required permissions to view the files attached to this post.
miab3
Zeos Test Team
Zeos Test Team
Posts: 1310
Joined: 11.05.2012, 12:32
Location: Poland

Re: dbmemo/dbgrid problem

Post by miab3 »

Hi,

As if change detection for the memo field itself is missing.

Michał
kjteng
Senior Boarder
Senior Boarder
Posts: 54
Joined: 10.05.2015, 15:02

Re: dbmemo/dbgrid problem

Post by kjteng »

Ya, if I have add a line 'fields[x].asString := fields[x].asString (x is another field) then the memofield will be updated.
Is there a bug somewhere?
marsupilami
Platinum Boarder
Platinum Boarder
Posts: 1939
Joined: 17.01.2011, 14:17

Re: dbmemo/dbgrid problem

Post by marsupilami »

kjteng wrote: 12.12.2021, 09:39 Is there a bug somewhere?
Hmmm - could you please check what happens if you disable the ZFields? I am not sure wether that has to happen in the Zeos.inc or in the properties of the dataset though...

Best regards,

Jan
kjteng
Senior Boarder
Senior Boarder
Posts: 54
Joined: 10.05.2015, 15:02

Re: dbmemo/dbgrid problem

Post by kjteng »

marsupilami wrote: 13.12.2021, 11:46 Hmmm - could you please check what happens if you disable the ZFields? I am not sure wether that has to happen in the Zeos.inc or in the properties of the dataset though...
You mean set the DisableZFields ? I tried ...same outcome whether disableZFields is True or False. The change in memofield would not be posted unless another field is edited.
User avatar
aehimself
Zeos Dev Team
Zeos Dev Team
Posts: 787
Joined: 18.11.2018, 17:37
Location: Hungary

Re: dbmemo/dbgrid problem

Post by aehimself »

Issue seems to be Lazarus-specific, I can not reproduce the issue with latest Zeos from Git using D10.4 and D7.
Upon starting to type, ZMemTable properly fires both .BeforeEdit & .AfterEdit events, upon changing records in the DBGrid both .BeforePost and .AfterPost is fired. Modified data is correctly retained in ZMemTable.

As I have no Lazarus experience and therefore none installed I can not debug this. If you feel adventurous, this is what I'd do:
  • Put a button on the form with the following code:

    Code: Select all

     ZMemTable1.Edit;
     Try
      If ZMemTable1.FieldByName('MemoField').IsNull Then ZMemTable1.FieldByName('MemoField').AsString := 'Test'
        Else ZMemTable1.FieldByName('MemoField').Clear;
     Finally
      ZMemTable1.Post;
     End;
  • Create a dummy .BeforeEdit and .BeforePost event handler and put breakpoints in them
  • Check which one is fired when editing manually
  • Click on the button. When the execution stops in the event handler which did NOT fire manually, go back in the stacktrace and put some breakpoints in. Use step over to find the condition which eventually bocks the call
  • Rinse and repeat until culprit is found
Delphi 12.1, Zeos 8 from latest GIT snapshot
Using:
- MySQL server 8.0.18; libmariadb.dll 3.3.8
- Oracle server 11.2.0, 12.1.0, 19.0.0; oci.dll 21.13
- MSSQL 2012, 2019; sybdb.dll FreeTDS_2435
- SQLite 3.45.2
Post Reply