Handle of ADO connection

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Lisichkin
Posts: 3
Joined: Thu 26 Jan 2006 09:52
Location: Russia

Handle of ADO connection

Post by Lisichkin » Mon 03 Dec 2007 12:02

Hi, I’m using SDAC 3.55.2.22, developer license number is CRSDA-01427.

In SDAC examples (Sdac\Demos\Dll) parameter TMSConnection passed as object

Code: Select all

procedure AssignConnection(MSConnection: TMSConnection); cdecl;
So, it is not possible of using this dll in project compiling in different languages (such as c#). And much more in this case we should have BORLNDMM.DLL.
How we can pass handle of ADO connection (or interface), as it did it in ADO?

Code: Select all

TADOConnection.ConnectionObject
_Connection = ADOInt._Connection;

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Wed 05 Dec 2007 09:26

SDAC does not provide such functionality.

Lisichkin
Posts: 3
Joined: Thu 26 Jan 2006 09:52
Location: Russia

Post by Lisichkin » Thu 06 Dec 2007 12:36

Can we pass in to dll instead of object TMSConnection, OLE DB interface’s?
So we keep @@SPID and in dll project do not create new connection to MS SQL.

Code: Select all

TMSHack=class(TMSConnection)
TOLEDBHack=class(TOLEDBConnection)

ExternalMS: TMSConnection;

TOLEDBHack(TMSHack(ExternalMS).FIConnection).FIDBInitialize := rIDBInitialize
TOLEDBHack(TMSHack(ExternalMS).FIConnection).FIDBProperties := rIDBProperties
TOLEDBHack(TMSHack(ExternalMS).FIConnection).FIDBCreateSession := rIDBCreateSession
TOLEDBHack(TMSHack(ExternalMS).FIConnection).FISessionProperties := rISessionProperties
TOLEDBHack(TMSHack(ExternalMS).FIConnection).FITransactionLocal := rITransactionLocal
Is this code error safe?

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Tue 11 Dec 2007 10:43

This code uses internal objects of SDAC. So we can not guarantee that it will be compatible with future versions of SDAC, therefore we do not recommend using the code.
We also did not check this code for the current SDAC, so if you insist on going the hack way, you should carefully test it before using it in a production applications.
We will consider possibility to implement such functionality in the future builds\versions of SDAC.

Post Reply