db_init function

Initializes the UltraLite runtime library.

Syntax
unsigned short db_init(
SQLCA * sqlca 
); 
Returns
  • 0 if an error occurs during processing (for example, during initialization of the persistent store). The error code is set in SQLCA.

  • Non-zero if there are no errors. You can begin using embedded SQL commands and functions.

Remarks

You must call this function before you make any other UltraLite library call, and before you execute any embedded SQL command.

In most cases, you should only call this function once, passing the address of the global sqlca variable (as 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. Carry out subsequent connections and transactions that use this SQLCA on a single thread.

Initializing the SQLCA also resets any settings from previously called ULEnable functions. If you re-initialize a SQLCA, you must issue any ULEnable functions the application requires.

See also