Public Member Functions |
|
| IMPORT_C void | BeginTransaction () |
| Begins a database transaction. |
|
| IMPORT_C void | Close () |
| Closes the connection to the database.
|
|
| IMPORT_C void | CommitL () |
| Commits a database transaction. |
|
| IMPORT_C TInt | GetLastError () |
| Obtain error information about the last
database operation. |
|
| IMPORT_C TInt | GetLastError (TDes &aErrorText) |
| Obtain error information about the last
database operation. |
|
| IMPORT_C TBool | IsOpen () |
| Checks the opened/closed state of this
handle. |
|
| IMPORT_C void | OpenL (const TDesC &aDatabaseName, const TDesC &aUserName, const TDesC &aPassword) |
| Opens a connection to a Mimer SQL database
server. |
|
| IMPORT_C void | OpenL (const TDesC &aConnectionString) |
| Opens a connection to a Mimer SQL database
server. |
|
| IMPORT_C void | RollbackL () |
| Undoes database changes made during a
transaction. |
|
Friends |
|
| class | RMimerCommand |
These objects are created by calling the static NewLC() method supplying a connection string. This connection string is documented below.
Once created, applications use the CreateCommandLC() method to create execution environments in which SQL statements may be executed. There may be one and only one transaction active within the connection. Calling one of the transaction manipulating methods BeginTransaction(), CommitL() or RollbackL() therefore affects all execution environments created by this object.
The below code fragment is an example on how this class is used.
RMimerDatabase database; _LIT(database,"the_database"); _LIT(username,"SYSADM"); _LIT(password,"SYSADM"); database.OpenL(database,username,password); // All is well. Most commonly, further operations will start by creating one or // more command objects. _LIT(query,"select CONTACT,PHONENUMBER from CONTACTS where CONTACTNAME like ?"); RMimerCommand cmd; cmd.Create(database,query); RMimerResultSet rs = cmd.ExecuteQueryL(); while (rs.Next()) { // Do something exciting with the result set. } // At the end of the day, we'll close the connection. cmd.Close();
|
|
Begins a database transaction. All operations up until the next CommitL() or RollbackL() call will be executed atomically. This call is ignored if there is an ongoing transaction. |
|
|
Closes the connection to the database. Once the connection is closed, the same RMimerDatabase object may be used again to open a new connection. |
|
|
Commits a database transaction. If the commit is successful, any changes are safely written to permanent storage. If the commit fails, perhaps because of a detected transaction conflict, a TRAP is thrown. See the Mimer SQL Manuals for more information on transaction conflicts. When a transaction is committed, any open cursors are automatically closed. |
|
|
Obtain error information about the last database operation. The error information is lost once another operation is performed on the database.
|
|
|
Obtain error information about the last database operation. The error information is lost once another operation is performed on the database.
|
|
|
Checks the opened/closed state of this handle.
|
|
||||||||||||||||
|
Opens a connection to a Mimer SQL database server. The database to open a connection to is identified using the supplied database name, user name and password.
|
|
|
Opens a connection to a Mimer SQL database server. The database to open a connection to is identified using the aConnectionString parameter. This string has the following appearance: <attribute>=<value>;<attribute>=<value>;... The following attributes exist:
An example of a connection string is: DATABASE=mimerdb;UID=SYSADM;PWD=SYSADM
|
|
|
Undoes database changes made during a transaction. When a transaction is rollbacked, any open cursors are automatically closed. |