This function is called once from the 'nspdmain' when the database driver is initialized at process startup. It normally allocates and returns a dbms-specific structure to be passed to all other routines. It also calls any dbms-specific initialization routines. This function does not open a connection to the database.
/* DBMSState is your DBMS-specific structures and calls. */
void *
Ns_PdDbInit(void) {
DBMSState *state;
int status = NS_OK;
if ((state = (DBMSState *)malloc(sizeof(DBMSState))) != NULL) {
/* Allocate or initialize other DBMS specific data */
/* ... */
if (status == NS_ERROR) {
return NULL;
} else {
return (void *)state;
}
}
}
|