Subject | Issue with TIBODataset.CanModify |
---|---|
Author | Nando Dessena |
Post date | 2004-01-16T10:05:59Z |
Hello,
I have discovered yet another difference in behaviour between
TIBOQuery and good ol' TQuery (well, every query component that has a
RequestLive property, actually). If you set TQuery.RequestLive to false
then TQuery.CanModify always returns False. This has a number of
implications, i.e. the data-aware controls set themselves to a
read-only state and don't try modify operations on the dataset, which
would throw exceptions.
Unfortunately TIBODataset.CanModify doesn't take RequestLive into
account. Here's the current (4.3Aa) code:
function TIBODataset.GetCanModify: boolean;
begin
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;
And my proposed modification:
function TIBODataset.GetCanModify: boolean;
begin
if not RequestLive 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;
BTW I haven't got the foggiest idea why the call to
InternalDataset.NeedToPost is necessary or even relevant here. Would
very much like to find out.
Does Jason or anyone else foresee any problems with this change? It is
not a light change compatibility-wise, as it has the potential to
expose logic bugs in applications, but IMHO it's the only right
behaviour (incidentally it makes my apps work as they did before ;-)).
If everybody thinks it is OK then I ask this change (or equivalent,
interface-wise) be integrated in IBO's next subrelease.
Thanks
--
Nando mailto:nandod@...
I have discovered yet another difference in behaviour between
TIBOQuery and good ol' TQuery (well, every query component that has a
RequestLive property, actually). If you set TQuery.RequestLive to false
then TQuery.CanModify always returns False. This has a number of
implications, i.e. the data-aware controls set themselves to a
read-only state and don't try modify operations on the dataset, which
would throw exceptions.
Unfortunately TIBODataset.CanModify doesn't take RequestLive into
account. Here's the current (4.3Aa) code:
function TIBODataset.GetCanModify: boolean;
begin
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;
And my proposed modification:
function TIBODataset.GetCanModify: boolean;
begin
if not RequestLive 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;
BTW I haven't got the foggiest idea why the call to
InternalDataset.NeedToPost is necessary or even relevant here. Would
very much like to find out.
Does Jason or anyone else foresee any problems with this change? It is
not a light change compatibility-wise, as it has the potential to
expose logic bugs in applications, but IMHO it's the only right
behaviour (incidentally it makes my apps work as they did before ;-)).
If everybody thinks it is OK then I ask this change (or equivalent,
interface-wise) be integrated in IBO's next subrelease.
Thanks
--
Nando mailto:nandod@...