The SQL Session of an SQL Table

An IliSQLTable object must have a properly defined SQL session before any real work can be done. The SQL session handles all requests sent to a database server. See SQL Sessions and Cursor Objects.

When defining an IliSQLDataSource gadget in Views Studio through the inspector, the SQL session can be edited through the Connection property. Editing this property causes a connection dialog box to be displayed in which the user can choose one of the following options:

  • Creating a custom session by entering all required connection parameters.

  • Selecting the name of an application-wide session.

An SQL session can be shared among several IliSQLTable objects by selecting the same application-wide session for each of them.

The rest of this section describes how these actions can be carried out in C++.

A custom session can be defined as follows:

IliSQLTable* sqlTbl;

...

IliSQLSession* session;

session = new IliSQLSession(“oracle”, “scott/tiger@orasrv”);

sqlTbl->setSQLSession(session);

An application-wide session can be selected as follows:

IliSQLTable* sqlTbl;

...

IliSQLSession* session;

session = IliSQLSession::GetRegisteredSession(“Main”);

sqlTbl->setSQLSession(session);

The SQL session that an IliSQLTable object uses to communicate with the database server can be retrieved in the following way:

IliSQLSession* session = sqlTbl->getEffectiveSQLSession();