Search code examples
delphidelphi-5devartodac

Assertion failure in DBAccess.pas


I am interested in upgrading a suite of software from ODAC v5 to v8.2.8.

One app in particular is causing problems. This application loads one of a set of secondary applications implemented as dlls.

LibHandle := LoadLibrary(PChar(dllname));
if LibHandle <> 0 then
begin
  @showForm := GetProcAddress(LibHandle,'ShowMainDllForm');
  if (@showForm <> nil) then
  begin
    try
      ShowForm(Application.Handle, @FGlobalVars, 1);

The launcher is fine - it has its own database connection, and I can step through the various ODAC units fairly happily.

However, the dll immediately excepts on attempting to open a cursor. The error is an Assertion Failure in the unit DBAccess.pas, called from MemDs.pas. I have stepped through this and have shown that the assertion failure is correct; Assert(FieldDesc is TCRFieldDesc) is receiving a TFieldDesc from MemDS.CreateFieldDefs().

I am stumped. How can it be that one calling method works fine (the launcher app) and the other (the dll) always fails ?

If anyone has experienced difficulties in this area I would appreciate any information, however tenuous it might sound


Solution

  • We have already fixed this problem. You can either download the latest ODAC version 8.6.12 or modify the line invoking Assert:

    in the TCustomDADataSet.GetFieldType method

    replace 
      Assert(FieldDesc is TCRFieldDesc);
    with
      Assert(IsClass(FieldDesc, TCRFieldDesc));