Contents Index db_fini function ULActiveSyncStream function pdf/preface.pdf

UltraLite User's Guide
  The Embedded SQL Interface
    Library function reference

db_init function


Prototype 

unsigned short db_init(SQLCA * sqlca ) ;

Description 

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:

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.

See also 

db_fini function

ULPalmLaunch function

Developing multi-threaded applications


Contents Index db_fini function ULActiveSyncStream function pdf/preface.pdf