You are not logged in.
Pages: 1
I try to get result of a query using my function
function GetValues(const sql: string; var ResData: variant): boolean
var
IRows: ISQLDBRows;
begin
result:= False;
IRows:= fProps.Execute(SQL, [], @ResData);
Result:=Assigned(IRows);
if result then
IRows.Step;
end;
But when IRows goes out of scope ResData has no data to access.
Is any way to use a temp variant and then copy values to ResData or I must iterate through IRows
and copy data to ResData as TDocVariantData(ResValues).AddValue(IRows.ColumnName(i), IRows.ColumnVariant(i))?
Offline
It is as expected: ResData is filled with a reference to the IRows instance...
So when IRows is finalized, ResData is not able to find the reference information.
Note that ResData is a custom variant, as defined in TSQLDBRowVariantType.
It is not a TDocVariantData kind of variant.
I've just added a new ISQLDBStatement.RowDocVariant method, to create directly a TDocVariant containing the row.
See https://synopse.info/fossil/info/113b21fbb5
Offline
Thank you,
you are really awesome, very fast, available, approachable, high knowledge.
Delphi community must be very proud with people like you,
I am very happy to cooperate with you
Offline
Pages: 1