コード例 #1
0
//-----------------------------------------------------------------------------
// dpiObject__free() [INTERNAL]
//   Free the memory for an object.
//-----------------------------------------------------------------------------
void dpiObject__free(dpiObject *obj, dpiError *error)
{
    dpiObject__close(obj, 0, error);
    if (obj->type) {
        dpiGen__setRefCount(obj->type, error, -1);
        obj->type = NULL;
    }
    if (obj->dependsOnObj) {
        dpiGen__setRefCount(obj->dependsOnObj, error, -1);
        obj->dependsOnObj = NULL;
    }
    dpiUtils__freeMemory(obj);
}
コード例 #2
0
//-----------------------------------------------------------------------------
// dpiDeqOptions__create() [INTERNAL]
//   Create a new subscription structure and return it. In case of error NULL
// is returned.
//-----------------------------------------------------------------------------
int dpiDeqOptions__create(dpiDeqOptions *options, dpiConn *conn,
        dpiError *error)
{
    dpiGen__setRefCount(conn, error, 1);
    options->conn = conn;
    return dpiOci__descriptorAlloc(conn->env->handle, &options->handle,
            DPI_OCI_DTYPE_AQDEQ_OPTIONS, "allocate descriptor", error);
}
コード例 #3
0
//-----------------------------------------------------------------------------
// dpiObjectType__free() [INTERNAL]
//   Free the memory for an object type.
//-----------------------------------------------------------------------------
void dpiObjectType__free(dpiObjectType *objType, dpiError *error)
{
    if (objType->conn) {
        dpiGen__setRefCount(objType->conn, error, -1);
        objType->conn = NULL;
    }
    if (objType->elementTypeInfo.objectType) {
        dpiGen__setRefCount(objType->elementTypeInfo.objectType, error, -1);
        objType->elementTypeInfo.objectType = NULL;
    }
    if (objType->schema) {
        dpiUtils__freeMemory((void*) objType->schema);
        objType->schema = NULL;
    }
    if (objType->name) {
        dpiUtils__freeMemory((void*) objType->name);
        objType->name = NULL;
    }
    dpiUtils__freeMemory(objType);
}
コード例 #4
0
//-----------------------------------------------------------------------------
// dpiDeqOptions__free() [INTERNAL]
//   Free the memory for a dequeue options structure.
//-----------------------------------------------------------------------------
void dpiDeqOptions__free(dpiDeqOptions *options, dpiError *error)
{
    if (options->handle) {
        dpiOci__descriptorFree(options->handle, DPI_OCI_DTYPE_AQDEQ_OPTIONS);
        options->handle = NULL;
    }
    if (options->conn) {
        dpiGen__setRefCount(options->conn, error, -1);
        options->conn = NULL;
    }
    dpiUtils__freeMemory(options);
}
コード例 #5
0
//-----------------------------------------------------------------------------
// dpiSodaDocCursor__free() [INTERNAL]
//   Free the memory for a SODA document cursor.
//-----------------------------------------------------------------------------
void dpiSodaDocCursor__free(dpiSodaDocCursor *cursor, dpiError *error)
{
    if (cursor->coll) {
        dpiGen__setRefCount(cursor->coll, error, -1);
        cursor->coll = NULL;
    }
    if (cursor->handle) {
        dpiOci__handleFree(cursor->handle, DPI_OCI_HTYPE_SODA_DOC_CURSOR);
        cursor->handle = NULL;
    }
    dpiUtils__freeMemory(cursor);
}
コード例 #6
0
//-----------------------------------------------------------------------------
// dpiSodaDocCursor__allocate() [INTERNAL]
//   Allocate and initialize a SODA document cursor structure.
//-----------------------------------------------------------------------------
int dpiSodaDocCursor__allocate(dpiSodaColl *coll, void *handle,
        dpiSodaDocCursor **cursor, dpiError *error)
{
    dpiSodaDocCursor *tempCursor;

    if (dpiGen__allocate(DPI_HTYPE_SODA_DOC_CURSOR, coll->env,
            (void**) &tempCursor, error) < 0)
        return DPI_FAILURE;
    dpiGen__setRefCount(coll, error, 1);
    tempCursor->coll = coll;
    tempCursor->handle = handle;
    *cursor = tempCursor;
    return DPI_SUCCESS;
}
コード例 #7
0
//-----------------------------------------------------------------------------
// dpiObject__allocate() [INTERNAL]
//   Allocate and initialize an object structure.
//-----------------------------------------------------------------------------
int dpiObject__allocate(dpiObjectType *objType, void *instance,
        void *indicator, dpiObject *dependsOnObj, dpiObject **obj,
        dpiError *error)
{
    dpiObject *tempObj;

    if (dpiGen__allocate(DPI_HTYPE_OBJECT, objType->env, (void**) &tempObj,
            error) < 0)
        return DPI_FAILURE;
    dpiGen__setRefCount(objType, error, 1);
    tempObj->type = objType;
    tempObj->instance = instance;
    tempObj->indicator = indicator;
    if (dependsOnObj) {
        dpiGen__setRefCount(dependsOnObj, error, 1);
        tempObj->dependsOnObj = dependsOnObj;
    }
    if (!instance) {
        if (dpiOci__objectNew(tempObj, error) < 0) {
            dpiObject__free(tempObj, error);
            return DPI_FAILURE;
        }
        if (dpiOci__objectGetInd(tempObj, error) < 0) {
            dpiObject__free(tempObj, error);
            return DPI_FAILURE;
        }
    }
    if (tempObj->instance && !dependsOnObj) {
        if (dpiHandleList__addHandle(objType->conn->objects, tempObj,
                &tempObj->openSlotNum, error) < 0) {
            dpiObject__free(tempObj, error);
            return DPI_FAILURE;
        }
    }
    *obj = tempObj;
    return DPI_SUCCESS;
}
コード例 #8
0
//-----------------------------------------------------------------------------
// dpiObjectType__allocate() [INTERNAL]
//   Allocate and initialize an object type structure.
//-----------------------------------------------------------------------------
int dpiObjectType__allocate(dpiConn *conn, void *param,
        uint32_t nameAttribute, dpiObjectType **objType, dpiError *error)
{
    dpiObjectType *tempObjType;

    // create structure and retain reference to connection
    *objType = NULL;
    if (dpiGen__allocate(DPI_HTYPE_OBJECT_TYPE, conn->env,
            (void**) &tempObjType, error) < 0)
        return DPI_FAILURE;
    dpiGen__setRefCount(conn, error, 1);
    tempObjType->conn = conn;

    // perform initialization
    if (dpiObjectType__init(tempObjType, param, nameAttribute, error) < 0) {
        dpiObjectType__free(tempObjType, error);
        return DPI_FAILURE;
    }

    *objType = tempObjType;
    return DPI_SUCCESS;
}