Beispiel #1
0
boolean OCI_ListFree
(
    OCI_List *list
)
{
    boolean res = TRUE;

    OCI_CHECK(list == NULL, FALSE);

    OCI_ListClear(list);

    if (list->mutex != NULL)
    {
        res = OCI_MutexFree(list->mutex);
    }

    OCI_FREE(list);

    return res;
}
Beispiel #2
0
boolean OCI_PoolClose
(
    OCI_Pool *pool
)
{
    boolean res = TRUE;

    OCI_CHECK_PTR(OCI_IPC_POOL, pool, FALSE);

    /* free all connections */

    OCI_ListForEach(pool->cons, (POCI_LIST_FOR_EACH) OCI_ConnectionClose);
    OCI_ListClear(pool->cons);
    OCI_ListFree(pool->cons);

    pool->cons = NULL;

    if (OCI_LIB_THREADED)
    {
        OCI_MutexFree(pool->mutex);
    }

 #if OCI_VERSION_COMPILE >= OCI_9_0

    if (OCILib.version_runtime >= OCI_9_0)
    {
        /* close pool handle */

        if (pool->handle != NULL)
        {
            if (pool->htype == OCI_HTYPE_CPOOL)
            {
                OCI_CALL0
                (
                    res, pool->err,

                    OCIConnectionPoolDestroy(pool->handle, pool->err,
                                             (ub4) OCI_DEFAULT)
                )
            }

        #if OCI_VERSION_COMPILE >= OCI_9_2

            else
            {
                OCI_CALL0
                (
                    res, pool->err,

                    OCISessionPoolDestroy(pool->handle, pool->err,
                                          (ub4) OCI_SPD_FORCE)
                )
            }

        #endif

            OCI_HandleFree((void *) pool->handle, (ub4) pool->htype);
        }

    #if OCI_VERSION_COMPILE >= OCI_9_2

        /* close authentification handle */

        if (pool->authp != NULL)
        {
            OCI_HandleFree((void *) pool->authp, (ub4) OCI_HTYPE_AUTHINFO);
        }

    #endif

        /* close error handle */

        if (pool->err != NULL)
        {
            OCI_HandleFree((void *) pool->err, (ub4) OCI_HTYPE_ERROR);
        }
    }

#endif

    pool->err    = NULL;
    pool->handle = NULL;
    pool->authp  = NULL;

    /* free strings */

    OCI_FREE(pool->name);
    OCI_FREE(pool->db);
    OCI_FREE(pool->user);
    OCI_FREE(pool->pwd);

    return res;
}