Perform clean-up associated with DBMS handle.
void Ns_PdDbCleanup (void *handle);
This function is called once from the 'nspdmain' when the database driver is being shut down just before the process exits. It performs cleanup associated with process shutdown and frees the database-specific handle.
This function is invoked during process shutdown, and the operating system may take care of garbage collecting malloc'ed memory, but you may want to use this function to provide specific database cleanup.
/* Things italicized would be your DBMS-specific structures and calls. */ void Ns_PdDbCleanup(void *handle) { DBMSState *state = (DBMSState *)handle; if (handle != NULL) { if (state->connected) { Ns_PdDbClose(handle); } free(state->sqlbuf); free(state); } }