diff --git a/src/dpiDeqOptions.c b/src/dpiDeqOptions.c index 309eb05e..6cb542f5 100644 --- a/src/dpiDeqOptions.c +++ b/src/dpiDeqOptions.c @@ -171,7 +171,7 @@ int dpiDeqOptions_getMsgId(dpiDeqOptions *options, const char **value, &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__rawPtr(options->env->handle, rawValue, (char **)value); dpiOci__rawSize(options->env->handle, rawValue, valueLength); return dpiGen__endPublicFn(options, DPI_SUCCESS, &error); } diff --git a/src/dpiImpl.h b/src/dpiImpl.h index 067e7e47..b1ba5c17 100644 --- a/src/dpiImpl.h +++ b/src/dpiImpl.h @@ -313,6 +313,7 @@ extern unsigned long dpiDebugLevel; #define DPI_SQLT_BIN 23 #define DPI_SQLT_LBI 24 #define DPI_SQLT_UIN 68 +#define DPI_SQLT_LVB 95 #define DPI_SQLT_AFC 96 #define DPI_SQLT_IBFLOAT 100 #define DPI_SQLT_IBDOUBLE 101 @@ -777,6 +778,7 @@ typedef union { void **asInterval; void **asLobLocator; void **asString; + void **asOciraw; void **asStmt; void **asRowid; int *asBoolean; @@ -1516,7 +1518,7 @@ int dpiOci__passwordChange(dpiConn *conn, const char *userName, int dpiOci__ping(dpiConn *conn, dpiError *error); int dpiOci__rawAssignBytes(void *envHandle, const char *value, uint32_t valueLength, void **handle, dpiError *error); -int dpiOci__rawPtr(void *envHandle, void *handle, void **ptr); +int dpiOci__rawPtr(void *envHandle, void *handle, char **ptr); int dpiOci__rawResize(void *envHandle, void **handle, uint32_t newSize, dpiError *error); int dpiOci__rawSize(void *envHandle, void *handle, uint32_t *size); diff --git a/src/dpiMsgProps.c b/src/dpiMsgProps.c index 24260897..561f0375 100644 --- a/src/dpiMsgProps.c +++ b/src/dpiMsgProps.c @@ -41,7 +41,7 @@ int dpiMsgProps__extractMsgId(dpiMsgProps *props, void *ociRaw, { const char *rawPtr; - dpiOci__rawPtr(props->env->handle, ociRaw, (void**) &rawPtr); + dpiOci__rawPtr(props->env->handle, ociRaw, (char **)&rawPtr); dpiOci__rawSize(props->env->handle, ociRaw, msgIdLength); if (*msgIdLength > props->bufferLength) { if (props->buffer) { @@ -259,7 +259,7 @@ int dpiMsgProps_getOriginalMsgId(dpiMsgProps *props, const char **value, &rawValue, NULL, DPI_OCI_ATTR_ORIGINAL_MSGID, "get attribute value", &error) < 0) return dpiGen__endPublicFn(props, DPI_FAILURE, &error); - dpiOci__rawPtr(props->env->handle, rawValue, (void**) value); + dpiOci__rawPtr(props->env->handle, rawValue, (char **)value); dpiOci__rawSize(props->env->handle, rawValue, valueLength); return dpiGen__endPublicFn(props, DPI_SUCCESS, &error); } diff --git a/src/dpiObject.c b/src/dpiObject.c index 2aabd9ec..d9c651c7 100644 --- a/src/dpiObject.c +++ b/src/dpiObject.c @@ -105,6 +105,11 @@ static void dpiObject__clearOracleValue(dpiObject *obj, dpiError *error, dpiOci__stringResize(obj->env->handle, &buffer->asString, 0, error); break; + case DPI_ORACLE_TYPE_RAW: + if (buffer->asRaw) + dpiOci__rawResize(obj->env->handle, &buffer->asRaw, 0, + error); + break; case DPI_ORACLE_TYPE_TIMESTAMP: if (buffer->asTimestamp) dpiOci__descriptorFree(buffer->asTimestamp, @@ -243,6 +248,17 @@ static int dpiObject__fromOracleValue(dpiObject *obj, dpiError *error, return DPI_SUCCESS; } break; + case DPI_ORACLE_TYPE_RAW: + if (nativeTypeNum == DPI_NATIVE_TYPE_BYTES) { + asBytes = &data->value.asBytes; + dpiOci__rawPtr(obj->env->handle, *value->asOciraw, + &asBytes->ptr); + dpiOci__rawSize(obj->env->handle, *value->asOciraw, + &asBytes->length); + asBytes->encoding = NULL; + return DPI_SUCCESS; + } + break; case DPI_ORACLE_TYPE_NATIVE_INT: if (nativeTypeNum == DPI_NATIVE_TYPE_INT64) return dpiDataBuffer__fromOracleNumberAsInteger(&data->value, @@ -385,6 +401,17 @@ static int dpiObject__toOracleValue(dpiObject *obj, dpiError *error, return DPI_SUCCESS; } break; + case DPI_ORACLE_TYPE_RAW: + buffer->asRaw = NULL; + if (nativeTypeNum == DPI_NATIVE_TYPE_BYTES) { + bytes = &data->value.asBytes; + if (dpiOci__rawAssignBytes(obj->env->handle, bytes->ptr, + bytes->length, &buffer->asRaw, error) < 0) + return DPI_FAILURE; + *ociValue = buffer->asRaw; + return DPI_SUCCESS; + } + break; case DPI_ORACLE_TYPE_NATIVE_INT: case DPI_ORACLE_TYPE_NUMBER: *ociValue = &buffer->asNumber; diff --git a/src/dpiOci.c b/src/dpiOci.c index 292e5be3..8432d91f 100644 --- a/src/dpiOci.c +++ b/src/dpiOci.c @@ -2445,7 +2445,7 @@ int dpiOci__rawAssignBytes(void *envHandle, const char *value, // dpiOci__rawPtr() [INTERNAL] // Wrapper for OCIRawPtr(). //----------------------------------------------------------------------------- -int dpiOci__rawPtr(void *envHandle, void *handle, void **ptr) +int dpiOci__rawPtr(void *envHandle, void *handle, char **ptr) { dpiError *error = NULL; diff --git a/src/dpiOracleType.c b/src/dpiOracleType.c index e22d20fc..595e31cc 100644 --- a/src/dpiOracleType.c +++ b/src/dpiOracleType.c @@ -309,6 +309,7 @@ static dpiOracleTypeNum dpiOracleType__convertFromOracle(uint16_t typeCode, case DPI_SQLT_ODT: return DPI_ORACLE_TYPE_DATE; case DPI_SQLT_BIN: + case DPI_SQLT_LVB: return DPI_ORACLE_TYPE_RAW; case DPI_SQLT_AFC: if (charsetForm == DPI_SQLCS_NCHAR) diff --git a/src/dpiSubscr.c b/src/dpiSubscr.c index 644d3983..f7fc5107 100644 --- a/src/dpiSubscr.c +++ b/src/dpiSubscr.c @@ -401,7 +401,7 @@ static int dpiSubscr__populateMessage(dpiSubscr *subscr, if (dpiOci__attrGet(descriptor, DPI_OCI_DTYPE_CHDES, &rawValue, NULL, DPI_OCI_ATTR_CHDES_XID, "get transaction id", error) < 0) return DPI_FAILURE; - dpiOci__rawPtr(subscr->env->handle, rawValue, (void**) &message->txId); + dpiOci__rawPtr(subscr->env->handle, rawValue, (char**) &message->txId); dpiOci__rawSize(subscr->env->handle, rawValue, &message->txIdLength); // populate event specific attributes