UltraLite Embedded SQL User's Guide
Embedded SQL Library Functions
unsigned short db_init(SQLCA * sqlca ) ;
Initializes the UltraLite runtime library and creates a new UltraLite database, if one does not exist.
This function must be called before any other library call is made, and before any embedded SQL command is executed. Exceptions to this rule are as follows:
On the Palm Computing Platform, the ULPalmLaunch function can be called before db_init. The resources that this library requires for your program are allocated and initialized on this call.
On the Palm Computing Platform, call db_init whenever ULPalmLaunch returns LAUNCH_SUCCESS_FIRST. For more information, see ULPalmLaunch function.
Functions that configure database storage can be called. These functions have names starting with ULEnable.
If there are any errors during processing (for example, during initialization of the persistent store), they are returned in the SQLCA and 0 is returned. If there are no errors, a non-zero value is returned and you can begin using embedded SQL commands and functions.
In most cases, this function should be called only once (passing the address of the global sqlca variable defined in the sqlca.h header file). If you have multiple execution paths in your application, you can use more than one db_init call, as long as each one has a separate sqlca pointer. This separate SQLCA pointer can be a user-defined one, or could be a global SQLCA that has been freed using db_fini.
In multi-threaded applications, each thread must call db_init to obtain a separate SQLCA. Subsequent connections and transactions that use this SQLCA must be carried out on a single thread.
Developing multi-threaded applications