Subject RE: [IBO] Assertion Failure
Author Jason Wharton
There is a fix for this coming out in the next release.
Here is the patch for it in IB_Components.pas.

Comment out the two lines of code in each of the below procedure methods.

procedure TIB_BDataset.FreeServerResources;
begin
  FBufferCursor.FreeServerResources;
  FFieldsCursor.FreeServerResources;
//  FreeAndNilMem( FCursorFetchPSQLDA );    Can't do this or it causes a problem.
//  FreeAndNilMem( FCursorFetchBuffer );
  if Assigned( FLocateCursor ) then
    FLocateCursor.FreeServerResources;
  if Assigned( FFilterCursor ) then
    FFilterCursor.FreeServerResources;
  inherited FreeServerResources;
end;

procedure TIB_BDataset.SetConnection( AValue: TIB_Connection );
begin
  if IB_Connection <> AValue then
  begin
    inherited SetConnection( AValue );
    if Assigned( FFieldsCursor ) then
      FFieldsCursor.IB_Connection := IB_Connection;
    if Assigned( FBufferCursor ) then
      FBufferCursor.IB_Connection := IB_Connection;
//  FreeAndNilMem( FCursorFetchPSQLDA );    Can't do this or it causes a problem.
//  FreeAndNilMem( FCursorFetchBuffer );
    if Assigned( FLocateCursor ) then
      FLocateCursor.IB_Connection := IB_Connection;
    if Assigned( FFilterCursor ) then
      FFilterCursor.IB_Connection := IB_Connection;
  end;
end;
procedure TIB_BDataset.SetTransaction( AValue: TIB_Transaction );
begin
  if IB_Transaction <> AValue then
  begin
    if ( Assigned( IB_Transaction )) and
       ( not Assigned( IB_TransForUpdates )) and
       ( NodeList.UpdatesPending or ( CachedUpdates and NeedToPost )) then
      IB_Transaction.SysAdjustCachedUpdatePendingCount( Self, false );
    inherited SetTransaction( AValue );
    FFieldsCursor.IB_Transaction := AValue;
    FBufferCursor.IB_Transaction := AValue;
//  FreeAndNilMem( FCursorFetchPSQLDA );    Can't do this or it causes a problem.
//  FreeAndNilMem( FCursorFetchBuffer );
    if Assigned( FLocateCursor ) then
      FLocateCursor.IB_Transaction := AValue;
    if Assigned( FFilterCursor ) then
      FFilterCursor.IB_Transaction := AValue;
    if ( Assigned( IB_Transaction )) and
       ( not Assigned( IB_TransForUpdates )) and
       ( NodeList.UpdatesPending or ( CachedUpdates and NeedToPost )) then
      IB_Transaction.SysAdjustCachedUpdatePendingCount( Self, true );
  end;
end;
 
procedure TIB_BDataset.SetTransactionForUpdates( AValue: TIB_Transaction );
begin
  if IB_TransForUpdates <> AValue then
  begin
    if Assigned( IB_TransForUpdates ) and
       ( NodeList.UpdatesPending or ( CachedUpdates and NeedToPost )) then
      IB_TransForUpdates.SysAdjustCachedUpdatePendingCount( Self, false );
    inherited SetTransactionForUpdates( AValue );
    FFieldsCursor.IB_TransForUpdates := AValue;
    FBufferCursor.IB_TransForUpdates := AValue;
//  FreeAndNilMem( FCursorFetchPSQLDA );    Can't do this or it causes a problem.
//  FreeAndNilMem( FCursorFetchBuffer );
    if Assigned( FLocateCursor ) then
      FLocateCursor.IB_TransForUpdates := AValue;
    if Assigned( FFilterCursor ) then
      FFilterCursor.IB_TransForUpdates := AValue;
    if Assigned( IB_TransForUpdates ) and
       ( NodeList.UpdatesPending or ( CachedUpdates and NeedToPost )) then
      IB_TransForUpdates.SysAdjustCachedUpdatePendingCount( Self, true );
  end;
end;
procedure TIB_BDataset.InvalidateSQLWithCursors;
begin
  InvalidateSQL;
  FFieldsCursor.InvalidateSQL;
  FBufferCursor.InvalidateSQL;
//  FreeAndNilMem( FCursorFetchPSQLDA );    Can't do this or it causes a problem.
//  FreeAndNilMem( FCursorFetchBuffer );
  if Assigned( FDescCursor ) then FDescCursor.InvalidateSQL;
  if Assigned( FGetBofCursor ) then FGetBofCursor.InvalidateSQL;
  if Assigned( FSyncBofCursor1 ) then FSyncBofCursor1.InvalidateSQL;
  if Assigned( FSyncEofCursor1 ) then FSyncEofCursor1.InvalidateSQL;
  if Assigned( FSyncBofCursor2 ) then FSyncBofCursor2.InvalidateSQL;
  if Assigned( FSyncEofCursor2 ) then FSyncEofCursor2.InvalidateSQL;
  if Assigned( FSyncBofCursor3 ) then FSyncBofCursor3.InvalidateSQL;
  if Assigned( FSyncEofCursor3 ) then FSyncEofCursor3.InvalidateSQL;
//  if Assigned( FNullBofCursor ) then FNullBofCursor.InvalidateSQL;
//  if Assigned( FNullEofCursor ) then FNullEofCursor.InvalidateSQL;
end;
 
Let me know if this clears it all up for you.

Also, be sure to close Delphi and go into the builds subfolder and rebuild the binaries by entering in the Build command-line batch file.
Kind regards,
Jason Wharton


From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com]
Sent: Tuesday, March 05, 2019 5:12 AM
To: IBObjects@yahoogroups.com
Subject: [IBO] Assertion Failure

Hello!

There is a random error in a function inside IB_Components.pas (version 5.9.9 2784), using a Firebird database version 2.5:

function TIB_BindingCursor.QuickFetch( Node: PIB_Node;
                                       NeedCursor,
                                       KeepCursor: boolean;
                                       LoadCurRecData: boolean ): boolean;

In line 36441:

Assert( Assigned( BDataset.FCursorFetchPSQLDA ));

An assertion failure exception is raised, even in release mode.

If I disable it, then an access violation is raised below:

ErrCode := IB_Session.isc_dsql_row_fetch2( @Status,
                                                     tmpTran.PtrHandle,
                                                     PstHandle,
                                                     IB_Connection.SQLDialect,
                                                     Self.Params.PSQLDA,
                                                     BDataset.FCursorFetchPSQLDA );

I really don't know how to handle this.
It's an erratic behaviour during an update of a table containing BLOB fields sub_type 1.

Thank you in advance.

Tiago.