Subject | RE: [IBO] TIB_Query.IsEmpty bug |
---|---|
Author | IBO Support List |
Post date | 2012-11-05T17:53:34Z |
I didn't get the problem to reproduce, but I think there is a change that
could make a positive difference.
In IB_Components.pas find this method implementation and change it to what I
have here:
function TIB_BDataset.IsEmpty( MinRows: integer ): boolean;
var
tmpCnt: integer;
begin
if ( not Prepared ) or ( not IsSelectSQL ) then
Result := true
else
begin
while ( Active ) and
( BufferRowCount < MinRows ) and
(( not BufferHasEof ) or
( not BufferHasBof )) do
begin
tmpCnt := MinRows - BufferRowCount - 1;
if ( BufferRowCount < MinRows ) and ( not BufferHasEof ) then
ValidateRows( EofRowNum, EofRowNum + tmpCnt );
tmpCnt := MinRows - BufferRowCount - 1;
if ( BufferRowCount < MinRows ) and ( not BufferHasBof ) then
ValidateRows( BofRowNum - tmpCnt, BofRowNum );
end;
Result := BufferRowCount < MinRows;
end;
end;
I added a check for Active in the loop that looks for whether things are
empty or not.
Please let me know how that works.
Jason
-----Original Message-----
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf
Of tomjanczkadao
Sent: 05 November 2012 04:58 AM
To: IBObjects@yahoogroups.com
Subject: [IBO] TIB_Query.IsEmpty bug
Hi
Upgrading IBO from 4_9_14_34 to 4_9_14_52 introduced bug in
TIB_Query.IsEmpty method. Under some circumstances it falls into infinite
<while> loop.
Bug is easy to reproduce (isolating this problem took 4 days however):
Start New Appliacation, drop on form IB_Connection, IB_Query, IB_DataSource,
IB_Grid and fill 3 events as below. Closing dataset in FormClose calls
internally Grid.GetDispalyText, where IsEmpty function hangs!
procedure TForm1.FormCreate(Sender: TObject);
begin
IB_Connection1.Username := 'SYSDBA';
IB_Connection1.Password := 'masterkey';
IB_Connection1.Path := 'C:\Program
Files\Firebird\Firebird_2_1\examples\empbuild\EMPLOYEE.FDB';
IB_Connection1.Connect;
IB_Query1.IB_Connection := IB_Connection1;
IB_DataSource1.DataSet := IB_Query1;
IB_Grid1.DataSource := IB_DataSource1;
IB_Grid1.Align := alClient;
IB_Grid1.TrackGridRow := True;
IB_Grid1.ListBoxStyle := True;
IB_Query1.FieldsVisible.Add('EMP_NO=F');
IB_Query1.SQL.Text := 'select EMP_NO, FIRST_NAME, LAST_NAME from
EMPLOYEE';
IB_Query1.Open;
IB_Query1.SelectAll(False);
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
IB_Query1.Close;
IB_Connection1.Disconnect;
end;
procedure TForm1.IB_Grid1GetDisplayText(Sender: TObject; ACol,
ARow: Integer; var AString: String);
begin
if not IB_Query1.IsEmpty then
begin
end;
end;
Regards, Tomek
------------------------------------
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Yahoo! Groups Links
could make a positive difference.
In IB_Components.pas find this method implementation and change it to what I
have here:
function TIB_BDataset.IsEmpty( MinRows: integer ): boolean;
var
tmpCnt: integer;
begin
if ( not Prepared ) or ( not IsSelectSQL ) then
Result := true
else
begin
while ( Active ) and
( BufferRowCount < MinRows ) and
(( not BufferHasEof ) or
( not BufferHasBof )) do
begin
tmpCnt := MinRows - BufferRowCount - 1;
if ( BufferRowCount < MinRows ) and ( not BufferHasEof ) then
ValidateRows( EofRowNum, EofRowNum + tmpCnt );
tmpCnt := MinRows - BufferRowCount - 1;
if ( BufferRowCount < MinRows ) and ( not BufferHasBof ) then
ValidateRows( BofRowNum - tmpCnt, BofRowNum );
end;
Result := BufferRowCount < MinRows;
end;
end;
I added a check for Active in the loop that looks for whether things are
empty or not.
Please let me know how that works.
Jason
-----Original Message-----
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf
Of tomjanczkadao
Sent: 05 November 2012 04:58 AM
To: IBObjects@yahoogroups.com
Subject: [IBO] TIB_Query.IsEmpty bug
Hi
Upgrading IBO from 4_9_14_34 to 4_9_14_52 introduced bug in
TIB_Query.IsEmpty method. Under some circumstances it falls into infinite
<while> loop.
Bug is easy to reproduce (isolating this problem took 4 days however):
Start New Appliacation, drop on form IB_Connection, IB_Query, IB_DataSource,
IB_Grid and fill 3 events as below. Closing dataset in FormClose calls
internally Grid.GetDispalyText, where IsEmpty function hangs!
procedure TForm1.FormCreate(Sender: TObject);
begin
IB_Connection1.Username := 'SYSDBA';
IB_Connection1.Password := 'masterkey';
IB_Connection1.Path := 'C:\Program
Files\Firebird\Firebird_2_1\examples\empbuild\EMPLOYEE.FDB';
IB_Connection1.Connect;
IB_Query1.IB_Connection := IB_Connection1;
IB_DataSource1.DataSet := IB_Query1;
IB_Grid1.DataSource := IB_DataSource1;
IB_Grid1.Align := alClient;
IB_Grid1.TrackGridRow := True;
IB_Grid1.ListBoxStyle := True;
IB_Query1.FieldsVisible.Add('EMP_NO=F');
IB_Query1.SQL.Text := 'select EMP_NO, FIRST_NAME, LAST_NAME from
EMPLOYEE';
IB_Query1.Open;
IB_Query1.SelectAll(False);
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
IB_Query1.Close;
IB_Connection1.Disconnect;
end;
procedure TForm1.IB_Grid1GetDisplayText(Sender: TObject; ACol,
ARow: Integer; var AString: String);
begin
if not IB_Query1.IsEmpty then
begin
end;
end;
Regards, Tomek
------------------------------------
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Yahoo! Groups Links