There is an error in function uDADOADriver.SetDataSetParams: In case the DataType of the parameter is in [datXml, datWideMemo, datMemo] a Null value raises an exception. Code should be modified as follows:
procedure SetDataSetParams(Params: TDAParamCollection; DataSet: TDataSet; aList: TThreadList);
var
I: Integer;
Ds: TOracleDataSet;
ParamIndex, OraType: Integer;
Name: string;
LOB: TLOBLocator;
begin
Ds := TOracleDataSet(DataSet);
if Ds.Variables.Count > Params.Count then
for I := Ds.VariableCount - 1 downto 0 do
if Params.ParamByName(Ds.VariableName(I)) = nil then
Ds.DeleteVariable(Ds.VariableName(I));
for I := 0 to Params.Count - 1 do
begin
ParamIndex := Ds.VariableIndex(Params[I].Name);
Name := HandleSqlName(Params[I].Name, Params[I].ParamType);
OraType := DataTypeDaToOra(Params[I].DataType);
// New Param
if ParamIndex = -1 then Ds.DeclareVariable(Name, OraType);
// Changed Param
if (ParamIndex > -1) and (Ds.VariableType(ParamIndex) <> DataTypeDaToOra(Params[I].DataType)) then begin
Ds.DeleteVariable(Params[I].Name);
Ds.DeclareVariable(Name, OraType);
end;
if Params[i].DataType in [datWideString] then begin
Ds.DeclareVariableCharSet(Name, ocfNational, ocsUTF16);
end;
// Set value
if Params[I].DataType in [datXml, datWideMemo, datMemo] then begin
if Params[I].DataType = datMemo then begin
LOB := TLOBLocator.CreateTemporary(Ds.Session, otCLOB, True);
if not (VarIsNull(Params[I].Value) or VarIsEmpty(Params[I].Value)) then
Lob.AsString := Params[I].Value;
end
else begin
LOB := TLOBLocator.CreateTemporary(Ds.Session, otNCLOB, True);
LOB.CharSetID := ocsUTF16;
if not (VarIsNull(Params[I].Value) or VarIsEmpty(Params[I].Value)) then
Lob.AsWideString := Params[I].Value;
end;
aList.Add(LOB);
Ds.SetComplexVariable(Name,Lob);
end
else if Params[I].DataType = datBlob then begin
LOB := TLOBLocator.CreateTemporary(Ds.Session, otBLOB, True);
if not (VarIsNull(Params[I].Value) or VarIsEmpty(Params[I].Value)) then
Lob.AsString := Params[I].Value;
aList.Add(LOB);
Ds.SetComplexVariable(Name, Lob);
end
else if Params[I].DataType = datBoolean then
Ds.SetVariable(Name, Integer(Params[I].Value))
else
Ds.SetVariable(Name, Params[I].Value);
end;
end;