Subject | Re: [IBO] Issue with TIBODataset.CanModify |
---|---|
Author | Nando Dessena |
Post date | 2004-01-19T20:13:52Z |
I wrote:
N> And my proposed modification:
N> function TIBODataset.GetCanModify: boolean;
N> begin
N> if not RequestLive then
N> Result := False
N> else if Assigned( IB_Transaction ) and IB_Transaction.ReadOnly then
N> Result := false
N> else
N> begin
N> Result := InternalDataset.NeedToPost;
N> if not Result then
N> Result := not FReadOnly;
N> end;
N> {!!!
N> begin
N> CursorPosChanged;
N> UpdateCursorPos;
N> InternalDataset.RowNum := InternalDataset.BufferRowNum;
N> Result := InternalDataset.CanModify;
N> end;
N> }
N> end;
I'm sorry, I have posted code not fully tested. The CachedUpdates case
must also be accounted for, so this is better:
function TIBODataset.GetCanModify: boolean;
begin
if not RequestLive and not (CachedUpdates and (Assigned(OnUpdateRecord) or (Assigned(UpdateObject)))) then
Result := False
else if Assigned( IB_Transaction ) and IB_Transaction.ReadOnly then
Result := false
else
begin
Result := InternalDataset.NeedToPost;
if not Result then
Result := not FReadOnly;
end;
{!!!
begin
CursorPosChanged;
UpdateCursorPos;
InternalDataset.RowNum := InternalDataset.BufferRowNum;
Result := InternalDataset.CanModify;
end;
}
end;
Ciao
--
Nando mailto:nandod@...
N> And my proposed modification:
N> function TIBODataset.GetCanModify: boolean;
N> begin
N> if not RequestLive then
N> Result := False
N> else if Assigned( IB_Transaction ) and IB_Transaction.ReadOnly then
N> Result := false
N> else
N> begin
N> Result := InternalDataset.NeedToPost;
N> if not Result then
N> Result := not FReadOnly;
N> end;
N> {!!!
N> begin
N> CursorPosChanged;
N> UpdateCursorPos;
N> InternalDataset.RowNum := InternalDataset.BufferRowNum;
N> Result := InternalDataset.CanModify;
N> end;
N> }
N> end;
I'm sorry, I have posted code not fully tested. The CachedUpdates case
must also be accounted for, so this is better:
function TIBODataset.GetCanModify: boolean;
begin
if not RequestLive and not (CachedUpdates and (Assigned(OnUpdateRecord) or (Assigned(UpdateObject)))) then
Result := False
else if Assigned( IB_Transaction ) and IB_Transaction.ReadOnly then
Result := false
else
begin
Result := InternalDataset.NeedToPost;
if not Result then
Result := not FReadOnly;
end;
{!!!
begin
CursorPosChanged;
UpdateCursorPos;
InternalDataset.RowNum := InternalDataset.BufferRowNum;
Result := InternalDataset.CanModify;
end;
}
end;
Ciao
--
Nando mailto:nandod@...