//----------------------------------------------------------------------------- // dpiObject_getPrevIndex() [PUBLIC] // Return the index of the previous entry in the collection preceding the // index specified. If there is no previous entry, exists is set to 0. //----------------------------------------------------------------------------- int dpiObject_getPrevIndex(dpiObject *obj, int32_t index, int32_t *prevIndex, int *exists) { dpiError error; int status; if (dpiObject__checkIsCollection(obj, __func__, &error) < 0) return dpiGen__endPublicFn(obj, DPI_FAILURE, &error); DPI_CHECK_PTR_NOT_NULL(obj, prevIndex) DPI_CHECK_PTR_NOT_NULL(obj, exists) status = dpiOci__tablePrev(obj, index, prevIndex, exists, &error); return dpiGen__endPublicFn(obj, status, &error); }
//----------------------------------------------------------------------------- // dpiDeqOptions__getAttrValue() [INTERNAL] // Get the attribute value in OCI. //----------------------------------------------------------------------------- static int dpiDeqOptions__getAttrValue(dpiDeqOptions *options, uint32_t attribute, const char *fnName, void *value, uint32_t *valueLength) { dpiError error; int status; if (dpiGen__startPublicFn(options, DPI_HTYPE_DEQ_OPTIONS, fnName, 1, &error) < 0) return dpiGen__endPublicFn(options, DPI_FAILURE, &error); DPI_CHECK_PTR_NOT_NULL(options, value) DPI_CHECK_PTR_NOT_NULL(options, valueLength) status = dpiOci__attrGet(options->handle, DPI_OCI_DTYPE_AQDEQ_OPTIONS, value, valueLength, attribute, "get attribute value", &error); return dpiGen__endPublicFn(options, status, &error); }
//----------------------------------------------------------------------------- // dpiSodaDocCursor_getNext() [PUBLIC] // Return the next document available from the cursor. //----------------------------------------------------------------------------- int dpiSodaDocCursor_getNext(dpiSodaDocCursor *cursor, uint32_t flags, dpiSodaDoc **doc) { dpiError error; uint32_t mode; void *handle; if (dpiSodaDocCursor__check(cursor, __func__, &error) < 0) return dpiGen__endPublicFn(cursor, DPI_FAILURE, &error); DPI_CHECK_PTR_NOT_NULL(cursor, doc) mode = DPI_OCI_DEFAULT; if (flags & DPI_SODA_FLAGS_ATOMIC_COMMIT) mode |= DPI_OCI_SODA_ATOMIC_COMMIT; if (dpiOci__sodaDocGetNext(cursor, &handle, mode, &error) < 0) return dpiGen__endPublicFn(cursor, DPI_FAILURE, &error); *doc = NULL; if (handle) { if (dpiSodaDoc__allocate(cursor->coll->db, handle, doc, &error) < 0) { dpiOci__handleFree(handle, DPI_OCI_HTYPE_SODA_DOCUMENT); return dpiGen__endPublicFn(cursor, DPI_FAILURE, &error); } (*doc)->binaryContent = cursor->coll->binaryContent; } return dpiGen__endPublicFn(cursor, DPI_SUCCESS, &error); }
//----------------------------------------------------------------------------- // dpiObject_getLastIndex() [PUBLIC] // Return the index of the last entry in the collection. //----------------------------------------------------------------------------- int dpiObject_getLastIndex(dpiObject *obj, int32_t *index, int *exists) { dpiError error; int32_t size; int status; if (dpiObject__checkIsCollection(obj, __func__, &error) < 0) return dpiGen__endPublicFn(obj, DPI_FAILURE, &error); DPI_CHECK_PTR_NOT_NULL(obj, index) DPI_CHECK_PTR_NOT_NULL(obj, exists) if (dpiOci__tableSize(obj, &size, &error) < 0) return dpiGen__endPublicFn(obj, DPI_FAILURE, &error); *exists = (size != 0); if (*exists) status = dpiOci__tableLast(obj, index, &error); else status = DPI_SUCCESS; return dpiGen__endPublicFn(obj, status, &error); }
//----------------------------------------------------------------------------- // dpiDeqOptions_getMsgId() [PUBLIC] // Return message id associated with dequeue options. //----------------------------------------------------------------------------- int dpiDeqOptions_getMsgId(dpiDeqOptions *options, const char **value, uint32_t *valueLength) { dpiError error; void *rawValue; if (dpiGen__startPublicFn(options, DPI_HTYPE_DEQ_OPTIONS, __func__, 1, &error) < 0) return dpiGen__endPublicFn(options, DPI_FAILURE, &error); DPI_CHECK_PTR_NOT_NULL(options, value) DPI_CHECK_PTR_NOT_NULL(options, valueLength) if (dpiOci__attrGet(options->handle, DPI_OCI_DTYPE_AQDEQ_OPTIONS, &rawValue, NULL, DPI_OCI_ATTR_DEQ_MSGID, "get attribute value", &error) < 0) return dpiGen__endPublicFn(options, DPI_FAILURE, &error); dpiOci__rawPtr(options->env->handle, rawValue, (void**) value); dpiOci__rawSize(options->env->handle, rawValue, valueLength); return dpiGen__endPublicFn(options, DPI_SUCCESS, &error); }
//----------------------------------------------------------------------------- // dpiObject_getSize() [PUBLIC] // Return the size of the collection. //----------------------------------------------------------------------------- int dpiObject_getSize(dpiObject *obj, int32_t *size) { dpiError error; int status; if (dpiObject__checkIsCollection(obj, __func__, &error) < 0) return dpiGen__endPublicFn(obj, DPI_FAILURE, &error); DPI_CHECK_PTR_NOT_NULL(obj, size) status = dpiOci__collSize(obj->type->conn, obj->instance, size, &error); return dpiGen__endPublicFn(obj, status, &error); }
//----------------------------------------------------------------------------- // dpiObjectType_createObject() [PUBLIC] // Create a new object of the specified type and return it. Return NULL on // error. //----------------------------------------------------------------------------- int dpiObjectType_createObject(dpiObjectType *objType, dpiObject **obj) { dpiError error; int status; // validate parameters if (dpiObjectType__check(objType, __func__, &error) < 0) return dpiGen__endPublicFn(objType, DPI_FAILURE, &error); DPI_CHECK_PTR_NOT_NULL(objType, obj) status = dpiObject__allocate(objType, NULL, NULL, NULL, obj, &error); return dpiGen__endPublicFn(objType, status, &error); }
//----------------------------------------------------------------------------- // dpiObjectType_getInfo() [PUBLIC] // Return information about the object type. //----------------------------------------------------------------------------- int dpiObjectType_getInfo(dpiObjectType *objType, dpiObjectTypeInfo *info) { dpiError error; if (dpiGen__startPublicFn(objType, DPI_HTYPE_OBJECT_TYPE, __func__, 0, &error) < 0) return dpiGen__endPublicFn(objType, DPI_FAILURE, &error); DPI_CHECK_PTR_NOT_NULL(objType, info) info->name = objType->name; info->nameLength = objType->nameLength; info->schema = objType->schema; info->schemaLength = objType->schemaLength; info->isCollection = objType->isCollection; info->elementTypeInfo = objType->elementTypeInfo; info->numAttributes = objType->numAttributes; return dpiGen__endPublicFn(objType, DPI_SUCCESS, &error); }