I have some fields, they are for the user ReadOnly. But the program can change this:
q1.FieldByName('Status').ReadOnly := False;
q1.FieldByName('Status').AsInteger := 1;
q1.FieldByName('Status').ReadOnly := True;
But:
q1.Post;
does not commit the change into the database, but the change is visible in the TDBGrid after post. After close an reopen the q1 the old value is there.
The Field has the ProfiderFlags.pfInUpdate set.
All other fields where are ReadOnly = False works well.
Thank you very much for fixing.
I have fix this bug. I have delete the code in line 760: "Metadata.IsReadOnly(I)".
if (Tmp = '') or ( Metadata.IsReadOnly(I) or ) not Metadata.IsWritable(I) or
: : :
Please commit this code into the original source.
Thank you very much.
I think Zeos behaves as intended here. Modifying the ReadOnly attribute of a field is not supported. Maybe you should move the following line to the AfterPost and Cancel events:
In Zeos V7.2.14, changed fields that are ReadOnly were always written to the database.
If this is no longer the case with Zeos V8, then there should at least be a property in TZConnection:CommitReadOnlyFields True/False
The way you have written it does not work, I have tested it:
OnBeforePost() >>> ReadOnly:=False
OnAfterPost() >>> ReadOnly:=True
does not work, because Zeos already calculates which fields should be written before calling OnBeforePost() and if I set the ReadOnly to False in OnBeforePost(), the field is still not written to the DB.
Anyway, if this remains as it is, many Zeos V7 users who have not yet switched to Zeos V8 will complain ;-)
Here my change, this works good for me.