[ Previous ] [ Contents ] [ Index ] [ Next ]

Ns_PdDbFlush

Overview

Flush a connection to the database.

Syntax

    void  Ns_PdDbFlush(void *handle);

Description

Flushes any pending data. Usually this function will call Ns_PdDbCancel or something similiar along with any other database specific clean-up routines. If the flush operation is successful, this function should call Ns_PdSendString with an OK_STATUS. On failure, the function should use Ns_PdSendString to return an error string.

Psuedo-code Example

    /* Things italicized would be your DBMS-specific structures and 
calls. */
    void
    Ns_PdDbFlush(void *handle) {
        DBMSState *state = (DBMSState *) handle;
        int               status = NS_OK;
        Ns_PdLog(Trace, "flush:");
        if (!DBMSActiveState(state)) {
            status = DBMSFinish(state);
        } else {
            Ns_PdLog(Error, "Active transaction aborted (%s)", 
    state->datasource);
            DBMSCancel(state);
            DBMSExec(state, "abort transaction;");
            DBMSFinish(state);
            status = NS_ERROR;
        }
        if (status == NS_OK) {
            Ns_PdSendString(OK_STATUS);
        } else {
            Ns_PdSendException(state->exceptionCode, 
    state->exceptionMsg);
        }
    }

Top of Page

[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright © 1996 America Online, Inc.