Ns_PdDbCleanup

Name

Ns_PdDbCleanup -- Perform clean-up associated with DBMS handle.

Syntax

void Ns_PdDbCleanup (void *handle);

Description

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.

Pseudo-code Example

/* DBMSState is 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);
  }
}