void DefineLongVarRaw(int position, OracleConnection connection) { ociType = OciDataType.LongVarRaw; fieldType = typeof(byte[]); // TODO: get via piece-wise - a chunk at a time definedSize = LongVarRawMaxValue; value = OciCalls.AllocateClear(definedSize); int status = 0; status = OciCalls.OCIDefineByPos(Parent, out handle, ErrorHandle, position + 1, value, definedSize, ociType, indicator, rlenp, IntPtr.Zero, 0); if (status != 0) { OciErrorInfo info = ErrorHandle.HandleError(); throw new OracleException(info.ErrorCode, info.ErrorMessage); } }
void DefineNumber(int position, OracleConnection connection) { fieldType = typeof(System.Decimal); value = OciCalls.AllocateClear(definedSize); ociType = OciDataType.Char; int status = 0; status = OciCalls.OCIDefineByPos(Parent, out handle, ErrorHandle, position + 1, value, definedSize, ociType, indicator, rlenp, IntPtr.Zero, 0); if (status != 0) { OciErrorInfo info = ErrorHandle.HandleError(); throw new OracleException(info.ErrorCode, info.ErrorMessage); } }
void DefineChar(int position, OracleConnection connection) { fieldType = typeof(System.String); int maxByteCount = Encoding.UTF8.GetMaxByteCount(definedSize); value = OciCalls.AllocateClear(maxByteCount); ociType = OciDataType.Char; int status = 0; status = OciCalls.OCIDefineByPos(Parent, out handle, ErrorHandle, position + 1, value, maxByteCount, ociType, indicator, rlenp, IntPtr.Zero, 0); OciErrorHandle.ThrowExceptionIfError(ErrorHandle, status); }
void DefineRaw(int position, OracleConnection connection) { ociType = OciDataType.Raw; fieldType = typeof(byte[]); value = OciCalls.AllocateClear(definedSize); int status = 0; status = OciCalls.OCIDefineByPos(Parent, out handle, ErrorHandle, position + 1, value, definedSize * 2, ociType, ref indicator, ref rlenp, IntPtr.Zero, 0); if (status != 0) { OciErrorInfo info = ErrorHandle.HandleError(); throw new OracleException(info.ErrorCode, info.ErrorMessage); } }
void DefineLongVarChar(int position, OracleConnection connection) { fieldType = typeof(System.String); // LONG VARCHAR max length is 2 to the 31 power - 5 // the first 4 bytes of a LONG VARCHAR value contains the length // Int32.MaxValue - 5 causes out of memory in mono on win32 // because I do not have 2GB of memory available // so Int16.MaxValue - 5 is used instead. // LAMESPEC for Oracle OCI - you can not get the length of the LONG VARCHAR value // until after you get the value. This could be why Oracle deprecated LONG VARCHAR. // If you specify a definedSize less then the length of the column value, // then you will get an OCI_ERROR ORA-01406: fetched column value was truncated // TODO: get via piece-wise - a chunk at a time definedSize = LongVarCharMaxValue; value = OciCalls.AllocateClear(definedSize); ociType = OciDataType.LongVarChar; int status = 0; status = OciCalls.OCIDefineByPos(Parent, out handle, ErrorHandle, position + 1, value, definedSize, ociType, indicator, rlenp, IntPtr.Zero, 0); Size = (short)definedSize; if (status != 0) { OciErrorInfo info = ErrorHandle.HandleError(); throw new OracleException(info.ErrorCode, info.ErrorMessage); } }