Page 1 of 1

Get Cursor from Package from DLL - assertion error

Posted: Tue 04 Mar 2008 15:33
by merdock
I need to put all DB component specific code into dll and work with it.

When i run code approximately noted below i get an assertion error
TESTCASE:

DLL

Code: Select all

Library
...
function CreateQuery:TDataSet;stdcall;
begin
  result:=TOraQuery.Create(OraSession1);
end;  
function GetSQL(var oraquery:TDataSet):TStrings;stdcall;
begin
  result:=TOraQuery(obj).SQL;
end;
Function GetParams(var oraquery:TDataSet):TStrings;stdcall;
begin
  result:=TOraQuery(obj).Params;
end;

PRG

Code: Select all

....//load init proc and etc
proc test;
q:TDataSet;
s:TStrings;
p:TParams;
begin
  q:=CreateQuery;
  s:=GetSQL(q);
  s.clear;
  s.add('begin mypkg.myproc(:a); end;');
  p:=GetParams(q);
  p[0].ParamType:=ptOutput;
  p[0].DataType:=ftCursor;
  q.open;  //raise assertion error in oraclasses.pas in 5730
end;
ODAC 6.25.2.14 Trial Oracle 10G

Thnx.

Posted: Thu 06 Mar 2008 08:07
by Plash
You cannot use DataType property of TParam class to set data type of TOraQuery's parameters.
You should use DataType property of TOraParam class. For example, you can add the following procedure to your DLL:

Code: Select all

procedure SetParamDataType(Param: TParam; DataType: TFieldType); stdcall; 
begin
  TOraParam(Param).DataType := DataType;
end;