This class combines the functions necesary for managing a connection to the database. If a new connection object is created, it is not connected. The connection to the database is established when a successful connect() call was performed.
Distribute the results of a COMMIT or ROLLBACK statment into dependent objects (for correct handling of PUTVAL commands).
Definition at line 2794 of file SQLDBC.h.
SQLDBC_Retcode SQLDBC::SQLDBC_Connection::connect | ( | const char * | connectURL, | |
SQLDBC_Length | connectURLLength, | |||
const char * | connectCommand, | |||
SQLDBC_Length | connectCommandLength, | |||
SQLDBC_StringEncoding | connectCommandEncoding, | |||
SQLDBC_ConnectProperties & | connectProperties | |||
) |
Opens a new database session using an explicit URL and a CONNECT statement.
This method should be used only for custom connections together with a custom implementation of the SQLDBC_IRuntime interface.
connectURL | The connect URL, which may be 0. | |
connectURLLength | The length of the connect URL, which may be SQLDBC_NTS to indicate a zero-terminated string. | |
connectCommand | The CONNECT statement. | |
connectCommandLength | The length of the CONNECT statement, which may be SQLDBC_NTS to indicate a zero-terminated string. | |
connectCommandEncoding | The code of the connect statement. | |
connectProperties | Connect properties. It is recommended that you set environmental options, such as SQL mode, component name and version, to correctly initialize the internal handling of the runtime, since neither the URL nor your CONNECT statement are parsed fetch these options. |
SQLDBC_Retcode SQLDBC::SQLDBC_Connection::connect | ( | const char * | servernode, | |
SQLDBC_Length | servernodeLength, | |||
const char * | serverdb, | |||
SQLDBC_Length | serverdbLength, | |||
const char * | username, | |||
SQLDBC_Length | usernameLength, | |||
const char * | password, | |||
SQLDBC_Length | passwordLength, | |||
const SQLDBC_StringEncoding | userpwdEncoding | |||
) |
Opens a new database session using the default values for the options.
servernode | The name of the database server (ASCII). | |
servernodeLength | The length in bytes of the database server name. | |
serverdb | The name of the database instance (ASCII). | |
serverdbLength | The length in bytes of the database instance name. | |
username | The name of the database user. The encoding of this string depends on the userpwdEncoding argument. | |
usernameLength | The length in bytes of the database user name. | |
password | The password of the database user. The encoding of this string depends on the userpwdEncoding argument. | |
passwordLength | The length in bytes of the database users password. | |
userpwdEncoding | The character encoding of the username/password combination. |
SQLDBC_Retcode SQLDBC::SQLDBC_Connection::connect | ( | const char * | servernode, | |
const char * | serverdb, | |||
const char * | username, | |||
const char * | password, | |||
const SQLDBC_StringEncoding | userpwdEncoding | |||
) |
Opens a new database session using the default values for the options.
This method interprets all character arguments as zero-terminated ASCII strings. User name and password must be in userpwdEncoding code.
servernode | The zero-terminated name of the database server (ASCII). | |
serverdb | The zero-terminated name of the database instance (ASCII). | |
username | The zero-terminated name of the database user. The encoding of this string depends on the userpwdEncoding argument. | |
password | The zero-terminated password of the database user. The encoding of this string depends on the userpwdEncoding argument. | |
userpwdEncoding | The character encoding of the username/password combination. |
SQLDBC_Retcode SQLDBC::SQLDBC_Connection::connect | ( | const char * | servernode, | |
const char * | serverdb, | |||
const char * | username, | |||
const char * | password | |||
) |
Opens a new database session using the default values for the options.
The method accepts all character arguments as zero-terminated ASCII strings.
servernode | The zero-terminated name of the database server (ASCII). | |
serverdb | The zero-terminated name of the database instance (ASCII). | |
username | The zero-terminated name of the database user (ASCII). | |
password | The zero-terminated password of the database user (ASCII). |
SQLDBC_Retcode SQLDBC::SQLDBC_Connection::connect | ( | const char * | servernode, | |
SQLDBC_Length | servernodeLength, | |||
const char * | serverdb, | |||
SQLDBC_Length | serverdbLength, | |||
const char * | username, | |||
SQLDBC_Length | usernameLength, | |||
const char * | password, | |||
SQLDBC_Length | passwordLength, | |||
const SQLDBC_StringEncoding | userpwdEncoding, | |||
const SQLDBC_ConnectProperties & | properties | |||
) |
Opens a new database session using the SQLDBC_ConnectProperties object.
For the connection options not specified, the following default values are used:
COMPNAME
APPLICATION
APPVERSION
UNICODE
SQLMODE
servernode | The name of the database server (ASCII). | |
servernodeLength | The length in bytes of the database server name. | |
serverdb | The name of the database instance (ASCII). | |
serverdbLength | The length in bytes of the database instance name. | |
username | The name of the database user. The encoding of this string depends on the userpwdEncoding argument. | |
usernameLength | The length in bytes of the database user name. | |
password | The password of the database user. The encoding of this string depends on the userpwdEncoding argument. | |
passwordLength | The length in bytes of the database users password. | |
userpwdEncoding | The character encoding of the username/password combination. | |
properties | Further connection properties. |
SQLDBC_Retcode SQLDBC::SQLDBC_Connection::connect | ( | const char * | servernode, | |
const char * | serverdb, | |||
const char * | username, | |||
const char * | password, | |||
const SQLDBC_StringEncoding | userpwdEncoding, | |||
const SQLDBC_ConnectProperties & | properties | |||
) |
Opens a new database session using the SQLDBC_ConnectProperties object.
This method interpres all character arguments as zero-terminated ASCII strings. User name and password must be in userpwdEncoding code.
servernode | The zero-terminated name of the database server (ASCII). | |
serverdb | The zero-terminated name of the database instance (ASCII). | |
username | The zero-terminated name of the database user. The encoding of this string depends on the userpwdEncoding argument. | |
password | The zero-terminated password of the database user. The encoding of this string depends on the userpwdEncoding argument. | |
userpwdEncoding | The character encoding of the username/password combination. | |
properties | Further connection properties. |
SQLDBC_Retcode SQLDBC::SQLDBC_Connection::connect | ( | const char * | servernode, | |
const char * | serverdb, | |||
const char * | username, | |||
const char * | password, | |||
const SQLDBC_ConnectProperties & | properties | |||
) |
Opens a new database session using the SQLDBC_ConnectProperties object.
This method interprets all character arguments as zero-terminated ASCII strings.
servernode | The zero-terminated name of the database server (ASCII). | |
serverdb | The zero-terminated name of the database instance (ASCII). | |
username | The zero-terminated name of the database user (ASCII). | |
password | The zero-terminated password of the database user (ASCII). | |
properties | Further connection properties. |
SQLDBC_Retcode SQLDBC::SQLDBC_Connection::connect | ( | ) |
Opens a new database session using the runtime abstraction interface.
This method attaches the connection object an existing session. It is recommended that you implement the virtual method getSession and releaseSession in the Runtime Abstraction Interface.
SQLDBC_Retcode SQLDBC::SQLDBC_Connection::connect | ( | const SQLDBC_ConnectProperties & | properties | ) |
Opens a new database session using the runtime abstraction interface.
This method attaches the connection object an existing session. It is recommended that you implement the virtual method getSession and releaseSession in the Runtime Abstraction Interface.
properties | Connection properties. |
SQLDBC_Statement* SQLDBC::SQLDBC_Connection::createStatement | ( | ) |
Creates an SQLDBC_Statement object for sending SQL statements to the database.
SQL statements without parameters are normally executed using SQLDBC_Statement objects. Applications executing SQL statements several times or binding parameters for input and/or output must use SQLDBC_PreparedStatement objects.
SQLDBC_PreparedStatement* SQLDBC::SQLDBC_Connection::createPreparedStatement | ( | ) |
Creates an SQLDBC_PreparedStatement object for sending SQL statements to the database.
An SQLDBC_PreparedStatement object is 'prepared' in the database server and can use binding variables for input/output parameters.
SQLDBC_Retcode SQLDBC::SQLDBC_Connection::commit | ( | ) |
Commits all changes to the database session.
All changes made since the previous COMMIT/ROLLBACK statement are stored, any database locks held by this SQLDBC_Connection object are released.
SQLDBC_Retcode SQLDBC::SQLDBC_Connection::rollback | ( | ) |
Undoes all changes made in the current transaction and releases any database locks held by this connection object.
void SQLDBC::SQLDBC_Connection::releaseStatement | ( | SQLDBC_Statement * | stmt | ) |
Releases an SQLDBC_Statement.
stmt | A reference to an SQLDBC_Statement object to be released. |
void SQLDBC::SQLDBC_Connection::releaseStatement | ( | SQLDBC_PreparedStatement * | stmt | ) |
Releases an SQLDBC_PreparedStatement.
stmt | A reference to an SQLDBC_PreparedStatement object to be released. |
SQLDBC_Retcode SQLDBC::SQLDBC_Connection::cancel | ( | ) |
Cancels the running database request that is executed on the connection. For cancellation of a running SQL command it is neccessary to call the cancel method asynchronously. Because of the asynchronous processing it is not guaranteed that the cancellation will be succeed. The returncode of the original function indicates whether the function completed or was cancelled. In case of cancelation the original function returns with the sql code -102 'SQL statement cancelled'. The the cancel methode returns with SQLDBC_OK if it has been send the cancel request to the database.
SQLDBC_Retcode SQLDBC::SQLDBC_Connection::close | ( | ) |
Closes the SQLDBC_Connection.
Releases the database and interface runtime resources immediately instead of waiting for them to be released by the destructor. The current transaction is rolled back.
After you called this method, you are able to connect again using one of the connect
methods.
SQLDBC_Retcode SQLDBC::SQLDBC_Connection::commitWorkRelease | ( | ) |
Closes the SQLDBC_Connection.
Releases the database and interface runtime resources immediately instead of waiting for them to be released by the destructor. The current transaction is committed.
connect
methods.
SQLDBC_Retcode SQLDBC::SQLDBC_Connection::disconnect | ( | ) |
Closes the SQLDBC_Connection.
Releases the database and interface runtime resources immediately instead of waiting for them to be released by the destructor. No SQL command that handles the current transaction is sent to the database, so the transaction may be implicitely rolled back by the database server.
After you called this method, you are able to connect again using one of the connect
methods.
void SQLDBC::SQLDBC_Connection::setAutoCommit | ( | SQLDBC_Bool | autocommit | ) |
Sets the AUTOCOMMIT mode for the connection.
autocommit | The value for AUTOCOMMIT mode. |
SQLDBC_Bool SQLDBC::SQLDBC_Connection::getAutoCommit | ( | ) | const |
Returns whether the connection is in AUTCOMMIT mode.
void SQLDBC::SQLDBC_Connection::setSQLMode | ( | SQLDBC_SQLMode | sqlmode | ) |
Sets the SQL mode.
sqlmode | The SQL mode to be used: SQLDBC_INTERNAL | SQLDBC_ANSI | SQLDBC_DB2 | SQLDBC_ORACLE |
SQLDBC_Retcode SQLDBC::SQLDBC_Connection::setTransactionIsolation | ( | SQLDBC_Int4 | isolationlevel | ) |
Sets the transaction isolation level.
isolationlevel | The isolation level to be used. Possible values for the isolation level are 0, 1, 10, 15, 2, 20, 3, or 30. The lowest level is 0. |
SQLDBC_Int4 SQLDBC::SQLDBC_Connection::getTransactionIsolation | ( | ) | const |
Returns the transaction isolation level.
SQLDBC_Bool SQLDBC::SQLDBC_Connection::isConnected | ( | ) | const |
Returns whether if the connection to the database was established.
SQLDBC_Int4 SQLDBC::SQLDBC_Connection::getKernelVersion | ( | ) | const |
Returns the kernel version.
It will be returned in the following format: <major_release><minor_releaser><correction_level>
SQLDBC_Bool SQLDBC::SQLDBC_Connection::isUnicodeDatabase | ( | ) | const |
Returns whether the database is an unicode database or not.
SQLDBC_DateTimeFormat::Format SQLDBC::SQLDBC_Connection::getDateTimeFormat | ( | ) | const |
Returns the currently active date/time format.
SQLDBC_ErrorHndl& SQLDBC::SQLDBC_ConnectionItem::error | ( | ) | [inherited] |
Returns a reference to the ErrorHndl object.
void SQLDBC::SQLDBC_ConnectionItem::clearError | ( | ) | [inherited] |
Deletes the error has been stored.
SQLDBC_SQLWarning* SQLDBC::SQLDBC_ConnectionItem::warning | ( | ) | [inherited] |
Returns a reference to an SQLWarning object stored in the SQLDBC_ConnectionItem object.
void SQLDBC::SQLDBC_ConnectionItem::clearWarnings | ( | ) | [inherited] |
Deletes the warning stored in the SQLWarning object.