Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs
Moderators: gto , cipto_kh , EgonHugeist
btrewern
Expert Boarder
Posts: 193 Joined: 06.10.2005, 18:51
Post
by btrewern » 07.03.2008, 13:14
It seems that setting a field's ReadOnly property to true on a Zeos dataset does not actually make the field read only.
Code: Select all
ZQuery1.Edit;
ZQuery1id.ReadOnly := True;
ZQuery1id.Value := 1; <-- This should raise an error
ZQuery1.Post; <-- This completes.
It's not a big problem but I think it's a bug. Does anyone know where to start in trying to fix this?
Regards,
Ben
btrewern
Expert Boarder
Posts: 193 Joined: 06.10.2005, 18:51
Post
by btrewern » 07.03.2008, 16:09
After a little digging I think I've found a fix:
Change ZAbstractRODataset.SetFieldData to read:
Code: Select all
procedure TZAbstractRODataset.SetFieldData(Field: TField; Buffer: Pointer);
var
ColumnIndex: Integer;
RowBuffer: PZRowBuffer;
WasNull: Boolean;
begin
WasNull := False;
if not Active then
raise EZDatabaseError.Create(SOperationIsNotAllowed4);
if not RequestLive and (Field.FieldKind = fkData) then
RaiseReadOnlyError;
if Field.ReadOnly and not (State = dsFilter) then -- Change is here
DatabaseErrorFmt(SFieldReadOnly, [Field.DisplayName]); -- and here
if not (State in dsWriteModes) then
DatabaseError(SNotEditing, Self);
...
...
Not well tested but seems to work here.
Regards,
Ben
btrewern
Expert Boarder
Posts: 193 Joined: 06.10.2005, 18:51
Post
by btrewern » 12.03.2008, 17:18
Added to Mantis so as to not be lost.
mdaems
Zeos Project Manager
Posts: 2766 Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:
Post
by mdaems » 12.03.2008, 21:23
Thanks Ben. Didn't find time yet...
What's that not (State = dsFilter) condition about? Just curious so I don't have to search that myself.
Mark
btrewern
Expert Boarder
Posts: 193 Joined: 06.10.2005, 18:51
Post
by btrewern » 13.03.2008, 12:02
It's related to OnFilterRecord. I'm not 100% sure if it's needed but I dragged it from the VCL.
Ben
mdaems
Zeos Project Manager
Posts: 2766 Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:
Post
by mdaems » 16.03.2008, 11:39
Done. SVN Rev. 349