boolean OCI_API OCI_MsgGetRaw ( OCI_Msg *msg, void *raw, unsigned int *size ) { unsigned int raw_size = 0; OCI_CHECK_PTR(OCI_IPC_MSG, msg, FALSE); OCI_CHECK_PTR(OCI_IPC_VOID, raw, FALSE); OCI_CHECK_PTR(OCI_IPC_VOID, size, FALSE); OCI_CHECK_COMPAT(msg->typinf->con, msg->typinf->tcode == OCI_UNKNOWN, FALSE); if ((msg->payload != NULL) && (msg->ind != OCI_IND_NULL)) { raw_size = OCIRawSize(msg->typinf->con->env, (OCIRaw *) msg->payload); if (*size > raw_size) { *size = raw_size; } memcpy(raw, OCIRawPtr(msg->typinf->con->env, msg->payload), (size_t) (*size)); } else { *size = 0; } OCI_RESULT(TRUE); return TRUE; }
boolean OCI_API OCI_MsgSetRaw ( OCI_Msg *msg, const void *raw, unsigned int size ) { boolean res = TRUE; OCI_CHECK_PTR(OCI_IPC_MSG, msg, FALSE); OCI_CHECK_COMPAT(msg->typinf->con, msg->typinf->tcode == OCI_UNKNOWN, FALSE); OCI_CALL2 ( res, msg->typinf->con, OCIRawAssignBytes(msg->typinf->con->env, msg->typinf->con->err, (ub1*) raw, (ub4) size, (OCIRaw **) &msg->payload) ) if ((res == TRUE) && (msg->payload != NULL) && (size > 0)) { msg->ind = OCI_IND_NOTNULL; } else { msg->ind = OCI_IND_NULL; } OCI_RESULT(res); return res; }
boolean OCI_API OCI_MsgSetObject ( OCI_Msg *msg, OCI_Object *obj ) { boolean res = TRUE; OCI_CHECK_PTR(OCI_IPC_MSG, msg, FALSE); OCI_CHECK_COMPAT(msg->typinf->con, msg->typinf->tcode != OCI_UNKNOWN, FALSE); if (obj != NULL) { /* assign the given object to the message internal object */ res = OCI_ObjectAssign((OCI_Object *) msg->obj, obj); if (res == TRUE) { msg->ind = OCI_IND_NOTNULL; } } else { msg->ind = OCI_IND_NULL; } OCI_RESULT(res); return res; }
boolean OCI_API OCI_EnqueuePut ( OCI_Library *pOCILib, OCI_Enqueue *enqueue, OCI_Msg *msg, ExceptionSink *xsink ) { boolean res = TRUE; void *ostr = NULL; int osize = -1; void *payload = NULL; void *ind = NULL; OCI_CHECK_PTR(pOCILib, OCI_IPC_ENQUEUE, enqueue, FALSE); OCI_CHECK_PTR(pOCILib, OCI_IPC_MSG, msg, FALSE); OCI_CHECK_COMPAT(pOCILib, enqueue->typinf->con, enqueue->typinf->tdo == msg->typinf->tdo, FALSE); ostr = OCI_GetInputMetaString(pOCILib, enqueue->name, &osize); /* get payload */ if (enqueue->typinf->tcode != OCI_UNKNOWN) { if (msg->ind != OCI_IND_NULL) { payload = msg->obj->handle; ind = msg->obj->tab_ind; } } else { payload = msg->payload; ind = &msg->ind; } /* enqueue message */ OCI_CALL2Q ( pOCILib, res, enqueue->typinf->con, OCIAQEnq(enqueue->typinf->con->cxt, pOCILib->err, (OraText*)ostr, enqueue->opth, msg->proph, enqueue->typinf->tdo, &payload, &ind, NULL, OCI_DEFAULT), xsink ) OCI_ReleaseMetaString(ostr); OCI_RESULT(pOCILib, res); return res; }
OCI_Object * OCI_API OCI_MsgGetObject ( OCI_Msg *msg ) { OCI_Object *obj = NULL; OCI_CHECK_PTR(OCI_IPC_MSG, msg, NULL); OCI_CHECK_COMPAT(msg->typinf->con, msg->typinf->tcode != OCI_UNKNOWN, NULL); if (msg->ind != OCI_IND_NULL) { obj = (OCI_Object *) msg->obj; } OCI_RESULT(TRUE); return obj; }
boolean OCI_API OCI_HashAddPointer ( OCI_HashTable *table, const otext *key, void *value ) { OCI_Variant v; OCI_LIB_CALL_ENTER(boolean, FALSE) OCI_CHECK_PTR(OCI_IPC_HASHTABLE, table) OCI_CHECK_COMPAT(NULL, table->type == OCI_HASH_POINTER) v.p_void = value; call_retval = call_status = OCI_HashAdd(table, key, v, OCI_HASH_POINTER); OCI_LIB_CALL_EXIT() }
boolean OCI_API OCI_HashAddString ( OCI_HashTable *table, const otext *key, const otext *value ) { OCI_Variant v; OCI_LIB_CALL_ENTER(boolean, FALSE) OCI_CHECK_PTR(OCI_IPC_HASHTABLE, table) OCI_CHECK_COMPAT(NULL, table->type == OCI_HASH_STRING) v.p_text = (otext *) value; call_retval = call_status = OCI_HashAdd(table, key, v, OCI_HASH_STRING); OCI_LIB_CALL_EXIT() }
void * OCI_API OCI_HashGetPointer ( OCI_HashTable *table, const otext *key ) { OCI_HashValue *v = NULL; OCI_LIB_CALL_ENTER(void *, NULL) OCI_CHECK_PTR(OCI_IPC_HASHTABLE, table) OCI_CHECK_COMPAT(NULL, table->type == OCI_HASH_POINTER) v = OCI_HashGetValue(table, key); if (v) { call_retval = v->value.p_void; } call_status = TRUE; OCI_LIB_CALL_EXIT() }
int OCI_API OCI_HashGetInt ( OCI_HashTable *table, const otext *key ) { OCI_HashValue *v = NULL; OCI_LIB_CALL_ENTER(int, 0) OCI_CHECK_PTR(OCI_IPC_HASHTABLE, table) OCI_CHECK_COMPAT(NULL, table->type == OCI_HASH_INTEGER) v = OCI_HashGetValue(table, key); if (v) { call_retval = v->value.num; } call_status = TRUE; OCI_LIB_CALL_EXIT() }
const otext * OCI_API OCI_HashGetString ( OCI_HashTable *table, const otext *key ) { OCI_HashValue *v = NULL; OCI_LIB_CALL_ENTER(const otext *, NULL) OCI_CHECK_PTR(OCI_IPC_HASHTABLE, table) OCI_CHECK_COMPAT(NULL, table->type == OCI_HASH_STRING) v = OCI_HashGetValue(table, key); if (v) { call_retval = v->value.p_text; } call_status = TRUE; OCI_LIB_CALL_EXIT() }
OCI_DirPath * OCI_API OCI_DirPathCreate ( OCI_TypeInfo *typinf, const mtext *partition, unsigned int nb_cols, unsigned int nb_rows ) { OCI_DirPath *dp = NULL; void *ostr = NULL; int osize = -1; boolean res = TRUE; OCI_CHECK_PTR(OCI_IPC_TYPE_INFO, typinf, NULL); OCI_CHECK_COMPAT(typinf->con, typinf->type != OCI_TIF_TYPE, NULL); OCI_CHECK_BOUND(typinf->con, nb_cols, 1, typinf->nb_cols, NULL); /* allocate direct path structure */ dp = (OCI_DirPath *) OCI_MemAlloc(OCI_IPC_DIRPATH, sizeof(*dp), (size_t) 1, TRUE); if (dp != NULL) { dp->con = typinf->con; dp->status = OCI_DPS_NOT_PREPARED; dp->typinf = typinf; dp->nb_rows = (ub2) nb_rows; dp->nb_cols = (ub2) nb_cols; dp->nb_cur = (ub2) dp->nb_rows; dp->err_col = 0; dp->err_row = 0; dp->nb_prcsd = 0; /* allocates direct context handle */ if (res == TRUE) { res = (OCI_SUCCESS == OCI_HandleAlloc((dvoid *) dp->con->env, (dvoid **) (void *) &dp->ctx, (ub4) OCI_HTYPE_DIRPATH_CTX, (size_t) 0, (dvoid **) NULL)); } /* set table name attribute */ if (res == TRUE) { osize = -1; ostr = OCI_GetInputMetaString(dp->typinf->name, &osize); OCI_CALL2 ( res, dp->con, OCIAttrSet((dvoid *) dp->ctx, (ub4) OCI_HTYPE_DIRPATH_CTX, (dvoid *) ostr, (ub4) osize, (ub4) OCI_ATTR_NAME, dp->con->err) ) OCI_ReleaseMetaString(ostr); } /* set schema name attribute */ if ((res == TRUE) && (dp->typinf->schema != NULL) && (dp->typinf->schema[0] != 0)) { osize = -1; ostr = OCI_GetInputMetaString(dp->typinf->schema, &osize); OCI_CALL2 ( res, dp->con, OCIAttrSet((dvoid *) dp->ctx, (ub4) OCI_HTYPE_DIRPATH_CTX, (dvoid *) ostr, (ub4) osize, (ub4) OCI_ATTR_SCHEMA_NAME, dp->con->err) ) OCI_ReleaseMetaString(ostr); } /* set partition name attribute */ if ((res == TRUE) && (partition != NULL) && (partition[0] != 0)) { osize = -1; ostr = OCI_GetInputMetaString(partition, &osize); OCI_CALL2 ( res, dp->con, OCIAttrSet((dvoid *) dp->ctx, (ub4) OCI_HTYPE_DIRPATH_CTX, (dvoid *) ostr, (ub4) osize, (ub4) OCI_ATTR_SUB_NAME, dp->con->err) ) OCI_ReleaseMetaString(ostr); } if (OCILib.version_runtime >= OCI_9_0) { ub4 num_rows = dp->nb_rows; /* set array size attribute */ OCI_CALL2 ( res, dp->con, OCIAttrSet((dvoid *) dp->ctx, (ub4) OCI_HTYPE_DIRPATH_CTX, (dvoid *) &num_rows, (ub4) sizeof(num_rows), (ub4) OCI_ATTR_NUM_ROWS, dp->con->err) ) }