internal OracleColumn(OciStatementHandle statementHandle, int ordinal, OciErrorHandle errorHandle, OracleConnection connection) { this._ordinal = ordinal; this._describeHandle = statementHandle.GetDescriptor(this._ordinal, errorHandle); this._connection = connection; this._connectionCloseCount = connection.CloseCount; }
internal OciRowidDescriptor GetRowid(OciHandle environmentHandle, OciErrorHandle errorHandle) { OciRowidDescriptor descriptor = new OciRowidDescriptor(environmentHandle); descriptor.GetRowid(this, errorHandle); return(descriptor); }
internal void CheckError(OciErrorHandle errorHandle, int rc) { switch (((OCI.RETURNCODE)rc)) { case OCI.RETURNCODE.OCI_INVALID_HANDLE: throw System.Data.Common.ADP.InvalidOperation(System.Data.OracleClient.Res.GetString("ADP_InternalError", new object[] { rc })); case OCI.RETURNCODE.OCI_ERROR: case OCI.RETURNCODE.OCI_NO_DATA: { Exception exception2 = System.Data.Common.ADP.OracleError(errorHandle, rc); if ((errorHandle != null) && errorHandle.ConnectionIsBroken) { OracleInternalConnection openInternalConnection = this.GetOpenInternalConnection(); if (openInternalConnection != null) { openInternalConnection.ConnectionIsBroken(); } } throw exception2; } case OCI.RETURNCODE.OCI_SUCCESS_WITH_INFO: { OracleInfoMessageEventArgs infoMessageEvent = new OracleInfoMessageEventArgs(OracleException.CreateException(errorHandle, rc)); this.OnInfoMessage(infoMessageEvent); return; } } if ((rc < 0) || (rc == 0x63)) { throw System.Data.Common.ADP.Simple(System.Data.OracleClient.Res.GetString("ADP_UnexpectedReturnCode", new object[] { rc.ToString(CultureInfo.CurrentCulture) })); } }
protected override DbSqlParserColumnCollection GatherTableColumns(DbSqlParserTable table) { OciStatementHandle stmtp = new OciStatementHandle(this._connection.ServiceContextHandle); OciErrorHandle errorHandle = this._connection.ErrorHandle; StringBuilder builder = new StringBuilder(); string schemaName = table.SchemaName; string tableName = table.TableName; DbSqlParserColumnCollection columns = new DbSqlParserColumnCollection(); builder.Append("select * from "); if (!System.Data.Common.ADP.IsEmpty(schemaName)) { builder.Append(schemaName); builder.Append("."); } builder.Append(tableName); string stmt = builder.ToString(); if ((TracedNativeMethods.OCIStmtPrepare(stmtp, errorHandle, stmt, OCI.SYNTAX.OCI_NTV_SYNTAX, OCI.MODE.OCI_DEFAULT, this._connection) == 0) && (TracedNativeMethods.OCIStmtExecute(this._connection.ServiceContextHandle, stmtp, errorHandle, 0, OCI.MODE.OCI_DESCRIBE_ONLY) == 0)) { int num3; stmtp.GetAttribute(OCI.ATTR.OCI_ATTR_PARAM_COUNT, out num3, errorHandle); for (int i = 0; i < num3; i++) { string str; OciParameterDescriptor handle = stmtp.GetDescriptor(i, errorHandle); handle.GetAttribute(OCI.ATTR.OCI_ATTR_SQLCODE, out str, errorHandle, this._connection); OciHandle.SafeDispose(ref handle); str = this.QuotePrefixCharacter + str + this.QuoteSuffixCharacter; columns.Add(null, schemaName, tableName, str, null); } } OciHandle.SafeDispose(ref stmtp); return(columns); }
private static void FromDecimal(OciErrorHandle errorHandle, decimal decimalValue, byte[] result) { int[] bits = decimal.GetBits(decimalValue); ulong ulongValue = (((ulong)bits[1]) << 0x20) | ((ulong)bits[0]); uint uintValue = (uint)bits[2]; int num3 = bits[3] >> 0x1f; int num = (bits[3] >> 0x10) & 0x7f; FromUInt64(errorHandle, ulongValue, result); if (uintValue != 0) { byte[] buffer = new byte[0x16]; FromUInt32(errorHandle, uintValue, buffer); InternalMul(errorHandle, buffer, OciNumberValue_TwoPow64, buffer); InternalAdd(errorHandle, result, buffer, result); } if (num3 != 0) { InternalNeg(errorHandle, result, result); } if (num != 0) { InternalShift(errorHandle, result, -num, result); } }
private static decimal ToDecimal(OciErrorHandle errorHandle, byte[] value) { byte[] n = (byte[])value.Clone(); byte[] result = new byte[0x16]; byte scale = 0; int num4 = InternalSign(errorHandle, n); if (num4 < 0) { InternalNeg(errorHandle, n, n); } if (!InternalIsInt(errorHandle, n)) { int digits = 2 * ((n[0] - ((n[1] & 0x7f) - 0x40)) - 1); InternalShift(errorHandle, n, digits, n); scale = (byte)(scale + ((byte)digits)); while (!InternalIsInt(errorHandle, n)) { InternalShift(errorHandle, n, 1, n); scale = (byte)(scale + 1); } } InternalMod(errorHandle, n, OciNumberValue_TwoPow64, result); ulong num2 = ToUInt64(errorHandle, result); InternalDiv(errorHandle, n, OciNumberValue_TwoPow64, result); InternalTrunc(errorHandle, result, 0, result); uint num6 = ToUInt32(errorHandle, result); return(new decimal((int)(num2 & 0xffffffffL), (int)(num2 >> 0x20), (int)num6, num4 < 0, scale)); }
internal static int MarshalToNative(object value, NativeBuffer buffer, int offset, OracleConnection connection) { byte[] buffer2; if (value is OracleNumber) { buffer2 = ((OracleNumber)value)._value; } else { OciErrorHandle errorHandle = connection.ErrorHandle; buffer2 = new byte[0x16]; if (value is decimal) { FromDecimal(errorHandle, (decimal)value, buffer2); } else if (value is int) { FromInt32(errorHandle, (int)value, buffer2); } else if (value is long) { FromInt64(errorHandle, (long)value, buffer2); } else { FromDouble(errorHandle, (double)value, buffer2); } } buffer.WriteBytes(offset, buffer2, 0, 0x16); return(0x16); }
internal OciEnlistContext(byte[] userName, byte[] password, byte[] serverName, OciServiceContextHandle serviceContextHandle, OciErrorHandle errorHandle) : base(IntPtr.Zero, true) { RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { this._serviceContextHandle = serviceContextHandle; int rc = 0; try { rc = TracedNativeMethods.OraMTSEnlCtxGet(userName, password, serverName, this._serviceContextHandle, errorHandle, out this.handle); } catch (DllNotFoundException exception) { throw System.Data.Common.ADP.DistribTxRequiresOracleServicesForMTS(exception); } if (rc != 0) { OracleException.Check(errorHandle, rc); } serviceContextHandle.AddRef(); } }
internal static void SafeDispose(ref OciErrorHandle handle) { if (handle != null) { handle.Dispose(); } handle = null; }
internal void SetExtraInfo(OciErrorHandle errorHandle, OciServerHandle serverHandle) { _errorHandle = new HandleRef(this, errorHandle.Handle.Handle); // OciHandle->HandleRef->IntPtr errorHandle.SetExternalOwnership(); _serverHandle = new HandleRef(this, serverHandle.Handle.Handle);// OciHandle->HandleRef->IntPtr serverHandle.SetExternalOwnership(); }
private static void InternalShift(OciErrorHandle errorHandle, byte[] n, int digits, byte[] result) { int rc = System.Data.Common.UnsafeNativeMethods.OCINumberShift(errorHandle, n, digits, result); if (rc != 0) { OracleException.Check(errorHandle, rc); } }
private static void InternalSub(OciErrorHandle errorHandle, byte[] x, byte[] y, byte[] result) { int rc = System.Data.Common.UnsafeNativeMethods.OCINumberSub(errorHandle, x, y, result); if (rc != 0) { OracleException.Check(errorHandle, rc); } }
private static void InternalTrunc(OciErrorHandle errorHandle, byte[] n, int position, byte[] result) { int rc = System.Data.Common.UnsafeNativeMethods.OCINumberTrunc(errorHandle, n, position, result); if (rc != 0) { OracleException.Check(errorHandle, rc); } }
private static void FromUInt64(OciErrorHandle errorHandle, ulong ulongValue, byte[] result) { int rc = System.Data.Common.UnsafeNativeMethods.OCINumberFromInt(errorHandle, ref ulongValue, 8, OCI.SIGN.OCI_NUMBER_UNSIGNED, result); if (rc != 0) { OracleException.Check(errorHandle, rc); } }
internal void SetAttribute(OCI.ATTR attribute, int value, OciErrorHandle errorHandle) { int rc = TracedNativeMethods.OCIAttrSet(this, ref value, 0, attribute, errorHandle); if (rc != 0) { OracleException.Check(errorHandle, rc); } }
internal void GetAttribute(OCI.ATTR attribute, out int value, OciErrorHandle errorHandle) { uint sizep = 0; int rc = TracedNativeMethods.OCIAttrGet(this, out value, out sizep, attribute, errorHandle); if (rc != 0) { OracleException.Check(errorHandle, rc); } }
private void CreateDeferredInfoMessage(OciErrorHandle errorHandle, int rc) { OracleInfoMessageEventArgs item = new OracleInfoMessageEventArgs(OracleException.CreateException(errorHandle, rc)); List <OracleInfoMessageEventArgs> list = this._deferredInfoMessageCollection; if (list == null) { list = this._deferredInfoMessageCollection = new List <OracleInfoMessageEventArgs>(); } list.Add(item); }
private static int InternalSign(OciErrorHandle errorHandle, byte[] n) { int num2; int rc = System.Data.Common.UnsafeNativeMethods.OCINumberSign(errorHandle, n, out num2); if (rc != 0) { OracleException.Check(errorHandle, rc); } return(num2); }
internal OciParameterDescriptor GetDescriptor(int i, OciErrorHandle errorHandle) { IntPtr ptr; int rc = TracedNativeMethods.OCIParamGet(this, base.HandleType, errorHandle, out ptr, i + 1); if (rc != 0) { OracleException.Check(errorHandle, rc); } return(new OciParameterDescriptor(this, ptr)); }
private static ulong ToUInt64(OciErrorHandle errorHandle, byte[] value) { ulong num2; int rc = System.Data.Common.UnsafeNativeMethods.OCINumberToInt(errorHandle, value, 8, OCI.SIGN.OCI_NUMBER_UNSIGNED, out num2); if (rc != 0) { OracleException.Check(errorHandle, rc); } return(num2); }
internal void GetRowid(OciStatementHandle statementHandle, OciErrorHandle errorHandle) { uint sizep = 0; int rc = TracedNativeMethods.OCIAttrGet(statementHandle, this, out sizep, OCI.ATTR.OCI_ATTR_ROWID, errorHandle); if (100 == rc) { base.Dispose(); } else if (rc != 0) { OracleException.Check(errorHandle, rc); } }
public static OracleNumber Shift(OracleNumber n, int digits) { if (n.IsNull) { return(Null); } OracleConnection.ExecutePermission.Demand(); OciErrorHandle errorHandle = TempEnvironment.GetErrorHandle(); OracleNumber number = new OracleNumber(false); InternalShift(errorHandle, n._value, digits, number._value); return(number); }
internal void SetAttribute(OCI.ATTR attribute, string value, OciErrorHandle errorHandle) { uint length = (uint)value.Length; byte[] bytes = new byte[length * 4]; uint size = this.GetBytes(value.ToCharArray(), 0, length, bytes, 0); int rc = TracedNativeMethods.OCIAttrSet(this, bytes, size, attribute, errorHandle); if (rc != 0) { OracleException.Check(errorHandle, rc); } }
public static OracleNumber Truncate(OracleNumber n, int position) { if (n.IsNull) { return(Null); } OracleConnection.ExecutePermission.Demand(); OciErrorHandle errorHandle = TempEnvironment.GetErrorHandle(); OracleNumber number = new OracleNumber(false); InternalTrunc(errorHandle, n._value, position, number._value); return(number); }
private static void FromDouble(OciErrorHandle errorHandle, double dblValue, byte[] result) { if ((dblValue < doubleMinValue) || (dblValue > doubleMaxValue)) { throw System.Data.Common.ADP.OperationResultedInOverflow(); } int rc = System.Data.Common.UnsafeNativeMethods.OCINumberFromReal(errorHandle, ref dblValue, 8, result); if (rc != 0) { OracleException.Check(errorHandle, rc); } }
public static OracleNumber operator %(OracleNumber x, OracleNumber y) { if (x.IsNull || y.IsNull) { return(Null); } OracleConnection.ExecutePermission.Demand(); OciErrorHandle errorHandle = TempEnvironment.GetErrorHandle(); OracleNumber number = new OracleNumber(false); InternalMod(errorHandle, x._value, y._value, number._value); return(number); }
private void FromString(OciErrorHandle errorHandle, string s, byte[] result) { byte[] buffer = new byte[0x16]; int digits = 0; s = s.Trim(); int length = s.IndexOfAny("eE".ToCharArray()); if (length > 0) { digits = int.Parse(s.Substring(length + 1), CultureInfo.InvariantCulture); s = s.Substring(0, length); } bool flag = false; if ('-' == s[0]) { flag = true; s = s.Substring(1); } else if ('+' == s[0]) { s = s.Substring(1); } int index = s.IndexOf('.'); if (0 <= index) { string str = s.Substring(index + 1); this.FromStringOfDigits(errorHandle, str, result); InternalShift(errorHandle, result, -str.Length, result); if (index != 0) { this.FromStringOfDigits(errorHandle, s.Substring(0, index), buffer); InternalAdd(errorHandle, result, buffer, result); } } else { this.FromStringOfDigits(errorHandle, s, result); } if (digits != 0) { InternalShift(errorHandle, result, digits, result); } if (flag) { InternalNeg(errorHandle, result, result); } GC.KeepAlive(s); }
internal void GetAttribute(OCI.ATTR attribute, out string value, OciErrorHandle errorHandle, OracleConnection connection) { IntPtr zero = IntPtr.Zero; uint sizep = 0; int rc = TracedNativeMethods.OCIAttrGet(this, ref zero, ref sizep, attribute, errorHandle); if (rc != 0) { OracleException.Check(errorHandle, rc); } byte[] destination = new byte[sizep]; Marshal.Copy(zero, destination, 0, (int)sizep); value = connection.GetString(destination); }
private static void Initialize() { lock (locked) { if (!isInitialized) { bool unicode = false; OCI.MODE environmentMode = OCI.MODE.OCI_DATA_AT_EXEC | OCI.MODE.OCI_BATCH_MODE; OCI.DetermineClientVersion(); environmentHandle = new OciEnvironmentHandle(environmentMode, unicode); availableErrorHandle = new OciErrorHandle(environmentHandle); isInitialized = true; } } }
private static string ToString(OciErrorHandle errorHandle, byte[] value) { byte[] buffer = new byte[0x40]; uint length = (uint)buffer.Length; int rc = System.Data.Common.UnsafeNativeMethods.OCINumberToText(errorHandle, value, "TM9", 3, IntPtr.Zero, 0, ref length, buffer); if (rc != 0) { OracleException.Check(errorHandle, rc); } int index = Array.IndexOf <byte>(buffer, 0x3a); index = (index > 0) ? index : Array.LastIndexOf(buffer, 0); return(Encoding.Default.GetString(buffer, 0, (index > 0) ? index : ((int)length))); }
internal static void Check(OciErrorHandle errorHandle, int rc) { switch (((OCI.RETURNCODE)rc)) { case OCI.RETURNCODE.OCI_INVALID_HANDLE: throw System.Data.Common.ADP.InvalidOperation(Res.GetString("ADP_InternalError", new object[] { rc })); case OCI.RETURNCODE.OCI_ERROR: case OCI.RETURNCODE.OCI_NO_DATA: throw System.Data.Common.ADP.OracleError(errorHandle, rc); } if (((rc < 0) || (rc == 0x63)) || (rc == 1)) { throw System.Data.Common.ADP.Simple(Res.GetString("ADP_UnexpectedReturnCode", new object[] { rc.ToString(CultureInfo.CurrentCulture) })); } }
internal static void Check(OciErrorHandle errorHandle, int rc) { switch (((OCI.RETURNCODE) rc)) { case OCI.RETURNCODE.OCI_INVALID_HANDLE: throw System.Data.Common.ADP.InvalidOperation(Res.GetString("ADP_InternalError", new object[] { rc })); case OCI.RETURNCODE.OCI_ERROR: case OCI.RETURNCODE.OCI_NO_DATA: throw System.Data.Common.ADP.OracleError(errorHandle, rc); } if (((rc < 0) || (rc == 0x63)) || (rc == 1)) { throw System.Data.Common.ADP.Simple(Res.GetString("ADP_UnexpectedReturnCode", new object[] { rc.ToString(CultureInfo.CurrentCulture) })); } }
internal static OracleException CreateException(OciErrorHandle errorHandle, int rc) { using (NativeBuffer buffer = new NativeBuffer_Exception(0x3e8)) { int num; string str; if (errorHandle != null) { int recordno = 1; int num2 = TracedNativeMethods.OCIErrorGet(errorHandle, recordno, out num, buffer); if (num2 == 0) { str = errorHandle.PtrToString(buffer); if (((num != 0) && str.StartsWith("ORA-00000", StringComparison.Ordinal)) && (TracedNativeMethods.oermsg((short) num, buffer) == 0)) { str = errorHandle.PtrToString(buffer); } } else { str = Res.GetString("ADP_NoMessageAvailable", new object[] { rc, num2 }); num = 0; } if (ConnectionIsBroken(num)) { errorHandle.ConnectionIsBroken = true; } } else { str = Res.GetString("ADP_NoMessageAvailable", new object[] { rc, -1 }); num = 0; } return new OracleException(str, num); } }
private static void FromDecimal(OciErrorHandle errorHandle, decimal decimalValue, byte[] result) { int[] bits = decimal.GetBits(decimalValue); ulong ulongValue = (((ulong) bits[1]) << 0x20) | ((ulong) bits[0]); uint uintValue = (uint) bits[2]; int num3 = bits[3] >> 0x1f; int num = (bits[3] >> 0x10) & 0x7f; FromUInt64(errorHandle, ulongValue, result); if (uintValue != 0) { byte[] buffer = new byte[0x16]; FromUInt32(errorHandle, uintValue, buffer); InternalMul(errorHandle, buffer, OciNumberValue_TwoPow64, buffer); InternalAdd(errorHandle, result, buffer, result); } if (num3 != 0) { InternalNeg(errorHandle, result, result); } if (num != 0) { InternalShift(errorHandle, result, -num, result); } }
private void CreateDeferredInfoMessage(OciErrorHandle errorHandle, int rc) { OracleInfoMessageEventArgs item = new OracleInfoMessageEventArgs(OracleException.CreateException(errorHandle, rc)); List<OracleInfoMessageEventArgs> list = this._deferredInfoMessageCollection; if (list == null) { list = this._deferredInfoMessageCollection = new List<OracleInfoMessageEventArgs>(); } list.Add(item); }
private static decimal ToDecimal(OciErrorHandle errorHandle, byte[] value) { byte[] n = (byte[]) value.Clone(); byte[] result = new byte[0x16]; byte scale = 0; int num4 = InternalSign(errorHandle, n); if (num4 < 0) { InternalNeg(errorHandle, n, n); } if (!InternalIsInt(errorHandle, n)) { int digits = 2 * ((n[0] - ((n[1] & 0x7f) - 0x40)) - 1); InternalShift(errorHandle, n, digits, n); scale = (byte) (scale + ((byte) digits)); while (!InternalIsInt(errorHandle, n)) { InternalShift(errorHandle, n, 1, n); scale = (byte) (scale + 1); } } InternalMod(errorHandle, n, OciNumberValue_TwoPow64, result); ulong num2 = ToUInt64(errorHandle, result); InternalDiv(errorHandle, n, OciNumberValue_TwoPow64, result); InternalTrunc(errorHandle, result, 0, result); uint num6 = ToUInt32(errorHandle, result); return new decimal((int) (num2 & 0xffffffffL), (int) (num2 >> 0x20), (int) num6, num4 < 0, scale); }
private bool OpenOnLocalTransaction(string userName, string password, string serverName, bool integratedSecurity, bool unicode, bool omitOracleConnectionName) { int rc = 0; OCI.MODE environmentMode = OCI.MODE.OCI_DATA_AT_EXEC | OCI.MODE.OCI_BATCH_MODE; OCI.DetermineClientVersion(); if (unicode) { if (OCI.ClientVersionAtLeastOracle9i) { environmentMode |= OCI.MODE.OCI_UTF16; } else { unicode = false; } } this._environmentHandle = new OciEnvironmentHandle(environmentMode, unicode); if (this._environmentHandle.IsInvalid) { throw System.Data.Common.ADP.CouldNotCreateEnvironment("OCIEnvCreate", rc); } this._errorHandle = new OciErrorHandle(this._environmentHandle); this._serverHandle = new OciServerHandle(this._errorHandle); this._sessionHandle = new OciSessionHandle(this._serverHandle); this._serviceContextHandle = new OciServiceContextHandle(this._sessionHandle); try { OCI.CRED cred; rc = TracedNativeMethods.OCIServerAttach(this._serverHandle, this._errorHandle, serverName, serverName.Length, OCI.MODE.OCI_DEFAULT); if (rc != 0) { if (1 == rc) { this.CreateDeferredInfoMessage(this.ErrorHandle, rc); } else { OracleException.Check(this.ErrorHandle, rc); } } this._serviceContextHandle.SetAttribute(OCI.ATTR.OCI_ATTR_SERVER, this._serverHandle, this._errorHandle); if (integratedSecurity) { cred = OCI.CRED.OCI_CRED_EXT; } else { cred = OCI.CRED.OCI_CRED_RDBMS; this._sessionHandle.SetAttribute(OCI.ATTR.OCI_ATTR_USERNAME, userName, this._errorHandle); if (password != null) { this._sessionHandle.SetAttribute(OCI.ATTR.OCI_ATTR_PASSWORD, password, this._errorHandle); } } if (!omitOracleConnectionName) { string dataSource = this._connectionOptions.DataSource; if (dataSource.Length > 0x10) { dataSource = dataSource.Substring(0, 0x10); } this._serverHandle.SetAttribute(OCI.ATTR.OCI_ATTR_EXTERNAL_NAME, dataSource, this._errorHandle); this._serverHandle.SetAttribute(OCI.ATTR.OCI_ATTR_INTERNAL_NAME, dataSource, this._errorHandle); } rc = TracedNativeMethods.OCISessionBegin(this._serviceContextHandle, this._errorHandle, this._sessionHandle, cred, OCI.MODE.OCI_DEFAULT); if (rc != 0) { if (1 == rc) { this.CreateDeferredInfoMessage(this.ErrorHandle, rc); } else { OracleException.Check(this.ErrorHandle, rc); } } this._serviceContextHandle.SetAttribute(OCI.ATTR.OCI_ATTR_SESSION, this._sessionHandle, this._errorHandle); } catch (OracleException) { OciHandle.SafeDispose(ref this._serviceContextHandle); OciHandle.SafeDispose(ref this._sessionHandle); OciHandle.SafeDispose(ref this._serverHandle); OciHandle.SafeDispose(ref this._errorHandle); OciHandle.SafeDispose(ref this._environmentHandle); throw; } return true; }
internal void CheckError(OciErrorHandle errorHandle, int rc) { switch (((OCI.RETURNCODE) rc)) { case OCI.RETURNCODE.OCI_INVALID_HANDLE: throw System.Data.Common.ADP.InvalidOperation(System.Data.OracleClient.Res.GetString("ADP_InternalError", new object[] { rc })); case OCI.RETURNCODE.OCI_ERROR: case OCI.RETURNCODE.OCI_NO_DATA: { Exception exception2 = System.Data.Common.ADP.OracleError(errorHandle, rc); if ((errorHandle != null) && errorHandle.ConnectionIsBroken) { OracleInternalConnection openInternalConnection = this.GetOpenInternalConnection(); if (openInternalConnection != null) { openInternalConnection.ConnectionIsBroken(); } } throw exception2; } case OCI.RETURNCODE.OCI_SUCCESS_WITH_INFO: { OracleInfoMessageEventArgs infoMessageEvent = new OracleInfoMessageEventArgs(OracleException.CreateException(errorHandle, rc)); this.OnInfoMessage(infoMessageEvent); return; } } if ((rc < 0) || (rc == 0x63)) { throw System.Data.Common.ADP.Simple(System.Data.OracleClient.Res.GetString("ADP_UnexpectedReturnCode", new object[] { rc.ToString(CultureInfo.CurrentCulture) })); } }
private static int InternalSign(OciErrorHandle errorHandle, byte[] n) { int num2; int rc = System.Data.Common.UnsafeNativeMethods.OCINumberSign(errorHandle, n, out num2); if (rc != 0) { OracleException.Check(errorHandle, rc); } return num2; }
private void FromStringOfDigits(OciErrorHandle errorHandle, string s, byte[] result) { if (s.Length <= 0x3f) { int rc = System.Data.Common.UnsafeNativeMethods.OCINumberFromText(errorHandle, s, (uint) s.Length, "999999999999999999999999999999999999999999999999999999999999999", 0x3f, IntPtr.Zero, 0, result); if (rc != 0) { OracleException.Check(errorHandle, rc); } } else { byte[] buffer = new byte[0x16]; string str2 = s.Substring(0, 0x3f); string str = s.Substring(0x3f); this.FromStringOfDigits(errorHandle, str2, buffer); this.FromStringOfDigits(errorHandle, str, result); InternalShift(errorHandle, buffer, str.Length, buffer); InternalAdd(errorHandle, result, buffer, result); } }
private static string ToString(OciErrorHandle errorHandle, byte[] value) { byte[] buffer = new byte[0x40]; uint length = (uint) buffer.Length; int rc = System.Data.Common.UnsafeNativeMethods.OCINumberToText(errorHandle, value, "TM9", 3, IntPtr.Zero, 0, ref length, buffer); if (rc != 0) { OracleException.Check(errorHandle, rc); } int index = Array.IndexOf<byte>(buffer, 0x3a); index = (index > 0) ? index : Array.LastIndexOf(buffer, 0); return Encoding.Default.GetString(buffer, 0, (index > 0) ? index : ((int) length)); }
private static ulong ToUInt64(OciErrorHandle errorHandle, byte[] value) { ulong num2; int rc = System.Data.Common.UnsafeNativeMethods.OCINumberToInt(errorHandle, value, 8, OCI.SIGN.OCI_NUMBER_UNSIGNED, out num2); if (rc != 0) { OracleException.Check(errorHandle, rc); } return num2; }
internal static Exception OracleError(OciErrorHandle errorHandle, int rc) { return TraceException(OracleException.CreateException(errorHandle, rc)); }