0

我有兴趣将一套软件从 ODAC v5 升级到 v8.2.8。

特别是一个应用程序会导致问题。此应用程序加载一组以 dll 形式实现的辅助应用程序中的一个。

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

启动器很好——它有自己的数据库连接,我可以相当愉快地逐步浏览各种 ODAC 单元。

但是,该 dll 在尝试打开游标时立即例外。错误是单元中的断言失败DBAccess.pas,从 调用MemDs.pas。我已经逐步完成并证明断言失败是正确的; Assert(FieldDesc is TCRFieldDesc)正在接收TFieldDesc来自MemDS.CreateFieldDefs().

我难住了。一种调用方法(启动器应用程序)工作正常而另一种(dll)总是失败怎么可能?

如果有人在这方面遇到困难,我将不胜感激任何信息,无论听起来多么脆弱

4

2 回答 2

1

we use the DEVART MySQL, and SQL connectors. I have experienced the exact issue with the MySQL (MyDAC) connection. However, what I found was this: In the DBAccess.pas file, the above code change was already there;

Assert(IsClass(FieldDesc, TCRFieldDesc));

But I was still getting the same Assertion error. I stepped in a little further, and found in the CRFunctions unit, I made the following changes, and now my Server connection works perfectly from a dll file:

begin
  if IsLibrary then
    Result := IsClassByName(Obj, AClass)
  else
  //------------------------------------
  // Danny MacNevin : October 3,2013
  // commented out the below line to fix an Assertion Error 
  // using the TMyConnection in a dll file.
  // It was being called from the DBAccess.pas file at line: 7251
  // To put this file back to normal, remove the line I added, and 
  // uncomment the line below...
  //------------------------------------
  //Result := Obj is AClass;
    Result := IsClassByName(Obj, AClass) //Line replaced by Danny
end;
于 2013-10-03T13:12:47.680 回答
1

我们已经解决了这个问题。您可以下载最新的 ODAC 版本 8.6.12 或修改调用 Assert 的行:

在 TCustomDADataSet.GetFieldType 方法中

replace 
  Assert(FieldDesc is TCRFieldDesc);
with
  Assert(IsClass(FieldDesc, TCRFieldDesc));
于 2013-03-21T09:27:09.540 回答