Menu
Simba Technologies
Simba Technologies

SimbaEngine X SDK 10.1.3
Developing Drivers for Data Stores Without SQL

Lifecycle of DSI Objects

The objects of the DSI API have a lifecycle that is modeled on, though not exactly the same as, the lifecycle of ODBC handles. This section explains the lifecycle in the C++ SDK for ODBC drivers.

The IDriver object is instantiated when the driver is loaded, and a single instance is alive until the driver is unloaded.

The IDriver object creates an IEnvironment when an application allocates environment handles. IDriver can create multiple IEnvironment objects. These are guaranteed to have been destroyed by the time the IDriver is destroyed.

IEnvironment create IConnections, which are guaranteed to have been destroyed by the time the parent IEnvironment has been destroyed. IConnections can be created and freed when an application chooses, but are typically long-lived objects, with multiple actions occurring before being destroyed.

IConnections create IStatements, which are guaranteed to have been destroyed by the time the parent IConnection has been destroyed. IStatements can be short- or long-lived objects depending on the application. If the application re-uses statements, then they tend to be long-lived, while if the application does not re-use statements they tend to be short-lived.

IStatements create IDataEngines, which are guaranteed to have been destroyed by the time the parent IStatement has been destroyed.

IDataEngines create IQueryExecutors, which are guaranteed to have been destroyed by the time the parent IDataEngine has been destroyed. IQueryExecutors have a lifespan that matches the lifespan of a prepared and executed, or directly executed, query. A single IQueryExecutor is used for multiple executions of a prepared query.

Note:

If you are using the Simba SQLEngine, the IQueryExecutor is already implemented by the SQLEngine.

Any objects created by an IQueryExecutor are guaranteed to have been destroyed by the time the parent IQueryExecutor has been destroyed.

IQueryExecutors create IResults, which are destroyed by the IQueryExecutors that created them. As stated above, IResults are guaranteed to have been destroyed before the IQueryExecutor.

IResult objects are accessed through IResults objects. However, the timing of their creation and destruction is determined by a driver’s implementation. The DSIResults implementation creates IResult objects during construction and destroys them during destruction. Note that an IResult object is not accessible after it has been destroyed by the parent IResultsobject.

 

Related Links

API Overview