Hi,
I'm wondering if there is any good way to get TUniConnectionAdapter from IDbConnection. I tested with type cast, worked on some cases and in some cases it gave invalid type case.
I need to get the actual database name behind that connection.
Well this did the job.
function GetDbNameFromConnection(aCon:idbConnection): string;
var
ds: Idbstatement;
q:TuniQuery;
begin
ds := aCon.createStatement;
q := TuniQuery((ds as IDBDatasetStatement).GetDataset);
result:= q.connection.Database;
end;
Hi Mika, this is the correct way of doing so:
function GetDbNameFromConnection(aCon:idbConnection): string;
var
UniConn: TUniConnection;
begin
UniConn := (aCon as IDBConnectionAdapter).AdaptedConnection as TUniConnection;
Result := UniConn.Database;
end;
and it's described in this section of documentation:
https://doc.tmssoftware.com/biz/aurelius/guide/database.html#referencing-original-component
1 Like
Sorry- have missed that totally in documentation. thanks
1 Like
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.