is there (or will there be in future releases) a way to get a real Tdataset as a result in a service?
My problem is, that I have to execute quite complex queries in a server service procedure. I can do this with the IDBStatement interface but the result is "only" an IDBResultSet, which does not have some of the conveniences of Tdataset.
So one way would be to get my original connection (UniDAC TUniConnection) in the service procedure (from the pool) to create my own TUniQuery instead of using IDBStatement. The other option I see would be use IDBStatement and get as a result a real Tdataset, with fielddefs and fieldtypes etc.
If You do not have any plans for this I will have a look into the sources, if it would somehow be possible to adapt the sources to my needs. Do You have any advice for that - where to search?
Kind regards
Harald
Instead of calling ExecuteQuery, you can cast IDBStatement to IDBDatasetStatement, and use GetDataset and Open to execute it:
var
Stmt: IDBStatement;
Dataset: TDataset;
begin
{...}
Dataset := (Stmt as IDBDatasetStatement).GetDataset;
Dataset.Open;
// Use Dataset as TDataset normally here
end;
Wagner R. Landgraf2018-05-09 13:12:37
Hello Wagner,
great support as always - I'm really glad that I decided to use XData.
This is exactly what I was looking for. Btw - is there a way to cast the connection (TUniConnection), too? It ist not necessary for me at the moment, but ... ;-)
Kind regards
Harald
I'm glad you're glad! :-)
var
MyConnection: IDBConnection;
UniConnection: TUniConnection;
{...}
UniConnection := (MyConnection as IDBConnectionAdapter).AdaptedConnection as TUniConnection;
Wagner R. Landgraf2018-05-09 13:16:39
Thanks. This sounds great.
I'm really sorry - I can't find the unit of IDBConnectionAdapter... :-(
just ignore my last post - I just installed the latest update of two days ago - and there I found the IDBConnectionAdapter in Aurelius.Drivers.Interfaces.
Kind regards
Haralde