internal void GetNames() { this._lob.AssertConnectionIsOpen(); short num5 = this.Connection.EnvironmentHandle.IsUnicode ? ((short) 2) : ((short) 1); ushort num = (ushort) (30 * num5); int offset = num; ushort num3 = (ushort) (0xff * num5); NativeBuffer scratchBuffer = this.Connection.GetScratchBuffer(num + num3); bool success = false; RuntimeHelpers.PrepareConstrainedRegions(); try { scratchBuffer.DangerousAddRef(ref success); int rc = TracedNativeMethods.OCILobFileGetName(this.Connection.EnvironmentHandle, this.ErrorHandle, this.Descriptor, scratchBuffer.DangerousGetDataPtr(), ref num, scratchBuffer.DangerousGetDataPtr(offset), ref num3); if (rc != 0) { this.Connection.CheckError(this.ErrorHandle, rc); } this._directoryAlias = this.Connection.GetString(scratchBuffer.ReadBytes(0, num)); this._fileName = this.Connection.GetString(scratchBuffer.ReadBytes(offset, num3)); } finally { if (success) { scratchBuffer.DangerousRelease(); } } }
internal static int MarshalToInt32(NativeBuffer buffer, int valueOffset) { byte[] buffer2 = buffer.ReadBytes(valueOffset, 5); int num3 = ((((buffer2[0] << 0x18) | (buffer2[1] << 0x10)) | (buffer2[2] << 8)) | buffer2[3]) - ((int)0x80000000L); int num2 = buffer2[4] - 60; int monthSpan = (num3 * 12) + num2; AssertValid(monthSpan); return(monthSpan); }
internal static int GetBytes(NativeBuffer buffer, int valueOffset, MetaType metaType, int sourceOffset, byte[] destinationBuffer, int destinationOffset, int byteCount) { if (!metaType.IsLong) { buffer.ReadBytes(valueOffset + sourceOffset, destinationBuffer, destinationOffset, byteCount); return(byteCount); } NativeBuffer_LongColumnData.CopyOutOfLineBytes(buffer.ReadIntPtr(valueOffset), sourceOffset, destinationBuffer, destinationOffset, byteCount); return(byteCount); }
internal static byte[] GetBytesFromBuffer(NativeBuffer buffer, int valueOffset, int lengthOffset, MetaType metaType, OracleConnection connection) { uint num2; OCI.DATATYPE ociType = metaType.OciType; short length = buffer.ReadInt16(lengthOffset); OCI.DATATYPE datatype = ociType; if (datatype == OCI.DATATYPE.DATE) { num2 = 7; } else if (datatype == OCI.DATATYPE.INT_TIMESTAMP) { num2 = 11; } else if (datatype == OCI.DATATYPE.INT_TIMESTAMP_LTZ) { num2 = 13; } else { num2 = 13; } byte[] destination = new byte[num2]; buffer.ReadBytes(valueOffset, destination, 0, length); if (OCI.DATATYPE.INT_TIMESTAMP_LTZ == ociType) { TimeSpan serverTimeZoneAdjustmentToUTC = connection.ServerTimeZoneAdjustmentToUTC; destination[11] = (byte)(serverTimeZoneAdjustmentToUTC.Hours + 20); destination[12] = (byte)(serverTimeZoneAdjustmentToUTC.Minutes + 60); return(destination); } if ((OCI.DATATYPE.INT_TIMESTAMP_TZ == ociType) && (0x80 < destination[11])) { sbyte num3; sbyte num4; OciIntervalDescriptor reftz = new OciIntervalDescriptor(connection.EnvironmentHandle); OciDateTimeDescriptor datetime = new OciDateTimeDescriptor(connection.EnvironmentHandle, OCI.HTYPE.OCI_DTYPE_TIMESTAMP_TZ); int rc = System.Data.Common.UnsafeNativeMethods.OCIDateTimeFromArray(connection.EnvironmentHandle, connection.ErrorHandle, destination, num2, 0xbc, datetime, reftz, 0); if (rc != 0) { connection.CheckError(connection.ErrorHandle, rc); } rc = System.Data.Common.UnsafeNativeMethods.OCIDateTimeGetTimeZoneOffset(connection.EnvironmentHandle, connection.ErrorHandle, datetime, out num4, out num3); if (rc != 0) { connection.CheckError(connection.ErrorHandle, rc); } destination[11] = (byte)(num4 + 20); destination[12] = (byte)(num3 + 60); } return(destination); }
internal static string MarshalToString(NativeBuffer buffer, int valueOffset, int lengthOffset, MetaType metaType, OracleConnection connection, bool boundAsUCS2, bool outputParameterBinding) { string str; int length = GetLength(buffer, lengthOffset, metaType); if (boundAsUCS2 && outputParameterBinding) { length /= 2; } bool flag = metaType.IsLong && !outputParameterBinding; if (boundAsUCS2) { if (flag) { byte[] destinationBuffer = new byte[length * System.Data.Common.ADP.CharSize]; NativeBuffer_LongColumnData.CopyOutOfLineBytes(buffer.ReadIntPtr(valueOffset), 0, destinationBuffer, 0, length * System.Data.Common.ADP.CharSize); str = Encoding.Unicode.GetString(destinationBuffer); } else { str = buffer.PtrToStringUni(valueOffset, length); } } else { byte[] buffer2; if (flag) { buffer2 = new byte[length]; NativeBuffer_LongColumnData.CopyOutOfLineBytes(buffer.ReadIntPtr(valueOffset), 0, buffer2, 0, length); } else { buffer2 = buffer.ReadBytes(valueOffset, length); } str = connection.GetString(buffer2, metaType.UsesNationalCharacterSet); } GC.KeepAlive(buffer); return(str); }
internal OracleNumber(NativeBuffer buffer, int valueOffset) : this(false) { buffer.ReadBytes(valueOffset, this._value, 0, 0x16); }
internal static long MarshalToInt64(NativeBuffer buffer, int valueOffset, OracleConnection connection) { byte[] buffer2 = buffer.ReadBytes(valueOffset, 0x16); return(ToInt64(connection.ErrorHandle, buffer2)); }
internal OracleTimeSpan(NativeBuffer buffer, int valueOffset) : this(true) { this._value = buffer.ReadBytes(valueOffset, 11); }
internal static TimeSpan MarshalToTimeSpan(NativeBuffer buffer, int valueOffset) { return(ToTimeSpan(buffer.ReadBytes(valueOffset, 11))); }