Using D5 and MIDAS, I encountered a problem with D5 that I didn't have with D4.
In my AppServer, I have some server side session info that I plug into a variable for a TOracleDataSet's SQL during a provider's OnDataRequest Event that was being cleared out by a call to DeleteVariables in the TOracleDataSet.PSSetParams call. To get around this problem, instead of deleting all the variables at the beginning of the procedure, I check to see if it exists before calling DeclareVariable. The following code is the 2 line change marked by "{ MWL }"
procedure TOracleDataSet.PSSetParams(AParams: TParams);
var p, DataType: Integer;
begin
// DeleteVariables; { MWL }
for p := 0 to AParams.Count - 1 do
begin
case AParams[p].DataType of
ftString: DataType := otString;
ftDate,
ftTime,
ftDateTime: DataType := otDate;
ftFloat,
ftCurrency,
ftBCD: DataType := otFloat;
ftInteger,
ftSmallInt,
ftWord: DataType := otInteger;
ftBlob: DataType := otLongRaw;
ftOraBLOB: DataType := otBLOB;
ftMemo: DataType := otLong;
ftOraCLOB: DataType := otCLOB;
ftCursor: DataType := otCursor;
else
DataType := -1;
end;
if DataType >= 0 then
begin
if VariableIndex(AParams[p].Name) < 0 then { MWL }
DeclareVariable(AParams[p].Name, DataType);
if not (DataType in [otBLOB, otCLOB, otCursor]) then
SetVariable(AParams[p].Name, AParams[p].Value);
end;
end;
end;
In my AppServer, I have some server side session info that I plug into a variable for a TOracleDataSet's SQL during a provider's OnDataRequest Event that was being cleared out by a call to DeleteVariables in the TOracleDataSet.PSSetParams call. To get around this problem, instead of deleting all the variables at the beginning of the procedure, I check to see if it exists before calling DeclareVariable. The following code is the 2 line change marked by "{ MWL }"
procedure TOracleDataSet.PSSetParams(AParams: TParams);
var p, DataType: Integer;
begin
// DeleteVariables; { MWL }
for p := 0 to AParams.Count - 1 do
begin
case AParams[p].DataType of
ftString: DataType := otString;
ftDate,
ftTime,
ftDateTime: DataType := otDate;
ftFloat,
ftCurrency,
ftBCD: DataType := otFloat;
ftInteger,
ftSmallInt,
ftWord: DataType := otInteger;
ftBlob: DataType := otLongRaw;
ftOraBLOB: DataType := otBLOB;
ftMemo: DataType := otLong;
ftOraCLOB: DataType := otCLOB;
ftCursor: DataType := otCursor;
else
DataType := -1;
end;
if DataType >= 0 then
begin
if VariableIndex(AParams[p].Name) < 0 then { MWL }
DeclareVariable(AParams[p].Name, DataType);
if not (DataType in [otBLOB, otCLOB, otCursor]) then
SetVariable(AParams[p].Name, AParams[p].Value);
end;
end;
end;