Architecture
The Mimer API routines may be divided into four major categories, depending on how they are used. These routine categories are:
•Session management - These routines manages a database session including connect, disconnect and transaction handling. See Session Management.
•Statement management - Once a session has been established, an application uses statements to interact with the database. Statements are defined using the SQL language and may be specified directly or created on the server in advance using the CREATE STATEMENT command. See Statement Management.
•Input data management - Used to supply input parameter data to statements. See Data Input Routines.
•Output data management - Obtains result sets and statement output parameter data. See Data Output Routines.
API routines having string parameters come in different flavors depending on which character string format is used. The rationale is that the base routine considers all strings to be null terminated wchar_t * strings.
If a routine has string parameters, there is a companion routine suffixed with C, which accepts the string parameters as null terminated char * strings, where the character set is defined by the current locale.
Companion routines suffixed with 8 have the string format UTF-8, regardless of locale settings.
In the Mimer API, the following routines are used for managing sessions; beginning and ending sessions, and beginning and ending transactions:
•MimerBeginSession[C|8]
The flow of calls should be according to the below. First, a session is started using a call to MimerBeginSession (or MimerBeginSession8 or MimerBeginSessionC, depending on the data types supplied).
Then database operations take place, either separately (in auto-committed transactions), or grouped in explicit transactions. The boundaries of an explicit transaction are marked using the calls to MimerBeginTransaction and MimerEndTransaction. (See Transactions for more information about transactions in the Mimer API.)
This process continues until the application terminates its database session through a call to MimerEndSession.
MimerBeginSession[C|8]
loop
{
MimerBeginTransaction
<statement and data management routines>
MimerEndTransaction
}
MimerEndSession
The routines used to manage statements are:
•MimerBeginStatement[C|8]
•MimerExecuteStatement[C|8]
Which routines to use basically depends on if the statement has input or output parameters, and if a result set is returned or not.
No input or output parameters, no result set
The MimerExecuteStatement[C|8] routine is mainly intended for DDL statements (i.e. data definition language statements, e.g. create and drop table.) However, it can also be used for UPDATE, INSERT, DELETE and CALL statements without parameters.
MimerExecuteStatement[C|8]
Input or output parameters, but no result set
The MimerExecute routine is used for INSERT, UPDATE and DELETE statements, assignments (SET), and procedure calls which do not return a result set.
MimerBeginStatement[C|8]
<data input routines>
MimerExecute
<data output routines>
MimerEndStatement
Result set producing statements
Result sets are returned by SELECT statements, as well as by calls to result set procedures. A result set is accessed using a cursor.
MimerBeginStatement[C|8]
<data input routines>
MimerOpenCursor
loop
{
MimerFetch/MimerFetchSkip/MimerFetchScroll
<data output routines>
}
MimerCloseCursor
MimerEndStatement
Input data management routines are used to supply input parameter data to statements. The data management routines to set input parameter data are:
•MimerSetNclobData[C|8]
•MimerSetString[C|8]
•MimerSetStringLen[C|8]
The output data management routines used to obtain statement results are:
•MimerGetNclobData[C|8]
•MimerGetString[C|8]