internal static int OCIAttrSet(OciHandle trgthndlp, OciHandle attributep, uint size, OCI.ATTR attrtype, OciHandle errhp) { if (Bid.AdvancedOn) { Bid.Trace("<oc.OCIAttrSet|ADV|OCI> trgthndlp=0x%-07Ix trghndltyp=%-18ls attributep=0x%-07Ix size=%d attrtype=%-22ls errhp=0x%-07Ix\n", trgthndlp, trgthndlp.HandleType, attributep, size, attrtype, errhp); } return System.Data.Common.UnsafeNativeMethods.OCIAttrSet(trgthndlp, trgthndlp.HandleType, attributep, size, attrtype, errhp); }
internal static int OCIAttrGet(OciHandle trgthndlp, OciHandle attributep, out uint sizep, OCI.ATTR attrtype, OciHandle errhp) { int num = System.Data.Common.UnsafeNativeMethods.OCIAttrGet(trgthndlp, trgthndlp.HandleType, attributep, out sizep, attrtype, errhp); if (Bid.AdvancedOn) { Bid.Trace("<oc.OCIAttrGet|ADV|OCI|RET> trgthndlp=0x%-07Ix trghndltyp=%-18ls attrtype=%-22ls errhp=0x%-07Ix attributep=0x%-18Ix sizep=%2d rc=%d\n", trgthndlp, trgthndlp.HandleType, attrtype, errhp, OciHandle.HandleValueToTrace(attributep), sizep, num); } return num; }
internal static int OCIAttrGet(OciHandle trgthndlp, ref IntPtr attributep, ref uint sizep, OCI.ATTR attrtype, OciHandle errhp) { int num = System.Data.Common.UnsafeNativeMethods.OCIAttrGet(trgthndlp, trgthndlp.HandleType, ref attributep, ref sizep, attrtype, errhp); if (Bid.AdvancedOn) { if (OCI.ATTR.OCI_ATTR_SQLCODE == attrtype) { Bid.Trace("<oc.OCIAttrGet|ADV|OCI|RET> trgthndlp=0x%-07Ix trghndltyp=%-18ls attrtype=%-22ls errhp=0x%-07Ix attributep=%-20ls sizep=%2d rc=%d\n", trgthndlp, trgthndlp.HandleType, attrtype, errhp, trgthndlp.PtrToString(attributep, (int) sizep), sizep, num); return num; } Bid.Trace("<oc.OCIAttrGet|ADV|OCI|RET> trgthndlp=0x%-07Ix trghndltyp=%-18ls attrtype=%-22ls errhp=0x%-07Ix attributep=0x%-18Ix sizep=%2d rc=%d\n", trgthndlp, trgthndlp.HandleType, attrtype, errhp, attributep, sizep, num); } return num; }
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; } } }
internal OciSimpleHandle(OciHandle parent, OCI.HTYPE handleType, IntPtr value) : base(handleType) { base.handle = value; }
internal static int OCIStmtPrepare(OciHandle stmtp, OciHandle errhp, string stmt, OCI.SYNTAX language, OCI.MODE mode, OracleConnection connection) { if (Bid.AdvancedOn) { Bid.Trace("<oc.OCIStmtPrepare|ADV|OCI> stmtp=0x%-07Ix errhp=0x%-07Ix stmt_len=%d language=%d{OCI.SYNTAX} mode=0x%x{OCI.MODE}\n\t\t%ls\n\n", stmtp, errhp, stmt.Length, (int) language, (int) mode, stmt); } byte[] bytes = connection.GetBytes(stmt, false); uint length = (uint) bytes.Length; int num = System.Data.Common.UnsafeNativeMethods.OCIStmtPrepare(stmtp, errhp, bytes, length, language, mode); if (Bid.AdvancedOn) { Bid.Trace("<oc.OCIStmtPrepare|ADV|OCI|RET> rc=%d\n", num); } return num; }
internal static int OCISessionEnd(IntPtr svchp, IntPtr errhp, IntPtr usrhp, OCI.MODE mode) { if (Bid.AdvancedOn) { Bid.Trace("<oc.OCISessionEnd|ADV|OCI> svchp=0x%-07Ix errhp=0x%-07Ix usrhp=0x%-07Ix mode=0x%x{OCI.MODE}\n", svchp, errhp, usrhp, (int) mode); } int num = System.Data.Common.UnsafeNativeMethods.OCISessionEnd(svchp, errhp, usrhp, mode); if (Bid.AdvancedOn) { Bid.Trace("<oc.OCISessionEnd|ADV|OCI|RET> rc=%d\n", num); } return num; }
internal static int OCIServerDetach(IntPtr srvhp, IntPtr errhp, OCI.MODE mode) { if (Bid.AdvancedOn) { Bid.Trace("<oc.OCIServerDetach|ADV|OCI> srvhp=0x%-07Ix errhp=0x%-07Ix mode=0x%x{OCI.MODE}\n", srvhp, errhp, (int) mode); } int num = System.Data.Common.UnsafeNativeMethods.OCIServerDetach(srvhp, errhp, mode); if (Bid.AdvancedOn) { Bid.Trace("<oc.OCIServerDetach|ADV|OCI|RET> rc=%d\n", num); } return num; }
internal static int OCIParamGet(OciHandle hndlp, OCI.HTYPE hType, OciHandle errhp, out IntPtr paramdpp, int pos) { int num = System.Data.Common.UnsafeNativeMethods.OCIParamGet(hndlp, hType, errhp, out paramdpp, (uint) pos); if (Bid.AdvancedOn) { Bid.Trace("<oc.OCIParamGet|ADV|OCI|RET> hndlp=0x%-07Ix htype=%-18ls errhp=0x%-07Ix pos=%d paramdpp=0x%-07Ix rc=%d\n", hndlp, hType, errhp, pos, paramdpp, num); } return num; }
private static OCI.HTYPE AssertDateTimeType(OCI.HTYPE dateTimeType) { return dateTimeType; }
internal static void Trace(string fmtPrintfW, OciHandle a1, OciHandle a2, uint a3, IntPtr a4, int a5, int a6, OCI.DATATYPE a7, IntPtr a8, IntPtr a9, IntPtr a10, int a11, IntPtr a12, int a13) { if (((modFlags & ApiGroup.Trace) != ApiGroup.Off) && (modID != NoData)) { NativeMethods.Trace(modID, UIntPtr.Zero, UIntPtr.Zero, fmtPrintfW, OciHandle.HandleValueToTrace(a1), OciHandle.HandleValueToTrace(a2), a3, a4, a5, a6, a7.ToString(), a8, a9, a10, a11, a12, a13); } }
internal static void Trace(string fmtPrintfW, OciHandle a1, OCI.HTYPE a2, OCI.ATTR a3, OciHandle a4, string a5, uint a6, int a7) { if (((modFlags & ApiGroup.Trace) != ApiGroup.Off) && (modID != NoData)) { NativeMethods.Trace(modID, UIntPtr.Zero, UIntPtr.Zero, fmtPrintfW, OciHandle.HandleValueToTrace(a1), a2.ToString(), OciHandle.GetAttributeName(a1, a3), OciHandle.HandleValueToTrace(a4), a5, a6, a7); } }
internal static void Trace(string fmtPrintfW, OciHandle a1, OCI.HTYPE a2, OciHandle a3, int a4, IntPtr a5, int a6) { if (((modFlags & ApiGroup.Trace) != ApiGroup.Off) && (modID != NoData)) { NativeMethods.Trace(modID, UIntPtr.Zero, UIntPtr.Zero, fmtPrintfW, OciHandle.HandleValueToTrace(a1), a2.ToString(), OciHandle.HandleValueToTrace(a3), a4, a5, a6); } }
public MetaType(System.Data.DbType dbType, System.Data.OracleClient.OracleType oracleType, OCI.DATATYPE ociType, string dataTypeName, Type convertToType, Type noConvertType, int bindSize, int maxBindSize, bool usesNationalCharacterSet) { this._dbType = dbType; this._oracleType = oracleType; this._ociType = ociType; this._convertToType = convertToType; this._noConvertType = noConvertType; this._bindSize = bindSize; this._maxBindSize = maxBindSize; this._dataTypeName = dataTypeName; this._usesNationalCharacterSet = usesNationalCharacterSet; switch (oracleType) { case System.Data.OracleClient.OracleType.Char: case System.Data.OracleClient.OracleType.Clob: case System.Data.OracleClient.OracleType.LongVarChar: case System.Data.OracleClient.OracleType.NChar: case System.Data.OracleClient.OracleType.NClob: case System.Data.OracleClient.OracleType.NVarChar: case System.Data.OracleClient.OracleType.VarChar: this._isCharacterType = true; break; } switch (oracleType) { case System.Data.OracleClient.OracleType.LongRaw: case System.Data.OracleClient.OracleType.LongVarChar: this._isLong = true; break; } switch (oracleType) { case System.Data.OracleClient.OracleType.BFile: case System.Data.OracleClient.OracleType.Blob: case System.Data.OracleClient.OracleType.Clob: case System.Data.OracleClient.OracleType.NClob: this._isLob = true; break; case System.Data.OracleClient.OracleType.Char: break; default: return; } }
internal static OciDateTimeDescriptor CreateDescriptor(OCI.DATATYPE ociType, OracleConnection connection, object value) { byte[] buffer; OCI.DATATYPE tIMESTAMP; if (value is OracleDateTime) { buffer = ((OracleDateTime) value)._value; } else { DateTime dt = (DateTime) value; OracleDateTime time2 = new OracleDateTime(dt); buffer = time2._value; } switch (ociType) { case OCI.DATATYPE.INT_TIMESTAMP: tIMESTAMP = OCI.DATATYPE.TIMESTAMP; break; case OCI.DATATYPE.INT_TIMESTAMP_LTZ: tIMESTAMP = OCI.DATATYPE.TIMESTAMP_LTZ; break; default: { tIMESTAMP = OCI.DATATYPE.TIMESTAMP_TZ; TimeSpan serverTimeZoneAdjustmentToUTC = connection.ServerTimeZoneAdjustmentToUTC; if (buffer.Length < 13) { byte[] dst = new byte[13]; Buffer.BlockCopy(buffer, 0, dst, 0, buffer.Length); buffer = dst; buffer[11] = (byte) (20 + serverTimeZoneAdjustmentToUTC.Hours); buffer[12] = (byte) (60 + serverTimeZoneAdjustmentToUTC.Minutes); } break; } } OciDateTimeDescriptor datetime = CreateEmptyDescriptor(ociType, connection); OciIntervalDescriptor reftz = new OciIntervalDescriptor(connection.EnvironmentHandle); int rc = System.Data.Common.UnsafeNativeMethods.OCIDateTimeFromArray(connection.EnvironmentHandle, connection.ErrorHandle, buffer, (uint) buffer.Length, (byte) tIMESTAMP, datetime, reftz, 9); if (rc != 0) { connection.CheckError(connection.ErrorHandle, rc); } return datetime; }
internal static OciDateTimeDescriptor CreateEmptyDescriptor(OCI.DATATYPE ociType, OracleConnection connection) { OCI.HTYPE htype; switch (ociType) { case OCI.DATATYPE.INT_TIMESTAMP: htype = OCI.HTYPE.OCI_DTYPE_TIMESTAMP; break; case OCI.DATATYPE.INT_TIMESTAMP_TZ: htype = OCI.HTYPE.OCI_DTYPE_TIMESTAMP_TZ; break; default: htype = OCI.HTYPE.OCI_DTYPE_TIMESTAMP_LTZ; break; } return new OciDateTimeDescriptor(connection.EnvironmentHandle, htype); }
internal static int OCILobWrite(OciHandle svchp, OciHandle errhp, OciHandle locp, ref int amtp, uint offset, IntPtr bufp, uint buflen, byte piece, ushort csid, OCI.CHARSETFORM csfrm) { uint num2 = (uint) amtp; if (Bid.AdvancedOn) { Bid.Trace("<oc.OCILobWrite|ADV|OCI> svchp=0x%-07Ix errhp=0x%-07Ix locp=0x%-07Ix amt=%d offset=%u bufp=0x%-07Ix buflen=%d piece=%d{Byte} ctxp=0x%-07Ix cbfp=0x%-07Ix csid=%d csfrm=%d{OCI.CHARSETFORM}\n", OciHandle.HandleValueToTrace(svchp), OciHandle.HandleValueToTrace(errhp), OciHandle.HandleValueToTrace(locp), amtp, offset, bufp, (int) buflen, piece, IntPtr.Zero, IntPtr.Zero, csid, (int) csfrm); } int num = System.Data.Common.UnsafeNativeMethods.OCILobWrite(svchp, errhp, locp, ref num2, offset, bufp, buflen, piece, IntPtr.Zero, IntPtr.Zero, csid, csfrm); amtp = (int) num2; if (Bid.AdvancedOn) { Bid.Trace("<oc.OCILobWrite|ADV|OCI|RET> amt=%d, rc=%d\n", amtp, num); } return num; }
internal OciDateTimeDescriptor(OciHandle parent, OCI.HTYPE dateTimeType) : base(parent, AssertDateTimeType(dateTimeType)) { }
internal static int OCIServerAttach(OciHandle srvhp, OciHandle errhp, string dblink, int dblink_len, OCI.MODE mode) { if (Bid.AdvancedOn) { Bid.Trace("<oc.OCIServerAttach|ADV|OCI> srvhp=0x%-07Ix errhp=0x%-07Ix dblink='%ls' dblink_len=%d mode=0x%x{OCI.MODE}\n", srvhp, errhp, dblink, dblink_len, (int) mode); } byte[] bytes = srvhp.GetBytes(dblink); int length = bytes.Length; int num = System.Data.Common.UnsafeNativeMethods.OCIServerAttach(srvhp, errhp, bytes, length, mode); if (Bid.AdvancedOn) { Bid.Trace("<oc.OCIServerAttach|ADV|OCI|RET> rc=%d\n", num); } return num; }
internal static int OCIBindByName(OciHandle stmtp, out IntPtr bindpp, OciHandle errhp, string placeholder, int placeh_len, IntPtr valuep, int value_sz, OCI.DATATYPE dty, IntPtr indp, IntPtr alenp, OCI.MODE mode) { if (Bid.AdvancedOn) { Bid.Trace("<oc.OCIBindByName|ADV|OCI> stmtp=0x%-07Ix errhp=0x%-07Ix placeholder=%-20ls placeh_len=%-2d valuep=0x%-07Ix value_sz=%-4d dty=%d{OCI.DATATYPE} indp=0x%-07Ix *indp=%-3d alenp=0x%-07Ix *alenp=%-4d rcodep=0x%-07Ix maxarr_len=%-4d curelap=0x%-07Ix mode=0x%x{OCI.MODE}\n", OciHandle.HandleValueToTrace(stmtp), OciHandle.HandleValueToTrace(errhp), placeholder, placeh_len, valuep, value_sz, (int) dty, indp, (IntPtr.Zero == indp) ? 0 : Marshal.ReadInt16(indp), alenp, (IntPtr.Zero == alenp) ? 0 : Marshal.ReadInt16(alenp), IntPtr.Zero, 0, IntPtr.Zero, (int) mode); } byte[] bytes = stmtp.GetBytes(placeholder); int length = bytes.Length; int num = System.Data.Common.UnsafeNativeMethods.OCIBindByName(stmtp, out bindpp, errhp, bytes, length, valuep, value_sz, dty, indp, alenp, IntPtr.Zero, 0, IntPtr.Zero, mode); if (Bid.AdvancedOn) { Bid.Trace("<oc.OCIBindByName|ADV|OCI|RET> bindpp=0x%-07Ix rc=%d\n", bindpp, num); } return num; }
internal static int OCISessionBegin(OciHandle svchp, OciHandle errhp, OciHandle usrhp, OCI.CRED credt, OCI.MODE mode) { if (Bid.AdvancedOn) { Bid.Trace("<oc.OCISessionBegin|ADV|OCI> svchp=0x%-07Ix errhp=0x%-07Ix usrhp=0x%-07Ix credt=%ls mode=0x%x{OCI.MODE}\n", svchp, errhp, usrhp, credt, (int) mode); } int num = System.Data.Common.UnsafeNativeMethods.OCISessionBegin(svchp, errhp, usrhp, credt, mode); if (Bid.AdvancedOn) { Bid.Trace("<oc.OCISessionBegin|ADV|OCI|RET> rc=%d\n", num); } return num; }
internal static int OCIDefineByPos(OciHandle stmtp, out IntPtr hndlpp, OciHandle errhp, uint position, IntPtr valuep, int value_sz, OCI.DATATYPE dty, IntPtr indp, IntPtr rlenp, IntPtr rcodep, OCI.MODE mode) { int num = System.Data.Common.UnsafeNativeMethods.OCIDefineByPos(stmtp, out hndlpp, errhp, position, valuep, value_sz, dty, indp, rlenp, rcodep, mode); if (Bid.AdvancedOn) { Bid.Trace("<oc.OCIDefineByPos|ADV|OCI|RET> stmtp=0x%-07Ix errhp=0x%-07Ix position=%-2d valuep=0x%-07Ix value_sz=%-4d dty=%-3d %-14ls indp=0x%-07Ix rlenp=0x%-07Ix rcodep=0x%-07Ix mode=0x%x{OCI.MODE} hndlpp=0x%-07Ix rc=%d\n", stmtp, errhp, position, valuep, value_sz, (int) dty, dty, indp, rlenp, rcodep, (int) mode, hndlpp, num); } return num; }
internal static int OCIStmtExecute(OciHandle svchp, OciHandle stmtp, OciHandle errhp, int iters, OCI.MODE mode) { if (Bid.AdvancedOn) { Bid.Trace("<oc.OCIStmtExecute|ADV|OCI> svchp=0x%-07Ix stmtp=0x%-07Ix errhp=0x%-07Ix iters=%d rowoff=%d snap_in=0x%-07Ix snap_out=0x%-07Ix mode=0x%x{OCI.MODE}\n", svchp, stmtp, errhp, iters, 0, IntPtr.Zero, IntPtr.Zero, (int) mode); } int num = System.Data.Common.UnsafeNativeMethods.OCIStmtExecute(svchp, stmtp, errhp, (uint) iters, 0, IntPtr.Zero, IntPtr.Zero, mode); if (Bid.AdvancedOn) { Bid.Trace("<oc.OCIStmtExecute|ADV|OCI|RET> rc=%d\n", num); } return num; }
internal static int OCIDefineDynamic(OciHandle defnp, OciHandle errhp, IntPtr octxp, OCI.Callback.OCICallbackDefine ocbfp) { if (Bid.AdvancedOn) { Bid.Trace("<oc.OCIDefineDynamic|ADV|OCI> defnp=0x%-07Ix errhp=0x%-07Ix octxp=0x%-07Ix ocbfp=...\n", OciHandle.HandleValueToTrace(defnp), OciHandle.HandleValueToTrace(errhp), octxp); } int num = System.Data.Common.UnsafeNativeMethods.OCIDefineDynamic(defnp, errhp, octxp, ocbfp); if ((num != 0) && Bid.AdvancedOn) { Bid.Trace("<oc.OCIDefineDynamic|ADV|OCI|RET> rc=%d\n", num); } return num; }
internal static int OCIStmtFetch(OciHandle stmtp, OciHandle errhp, int nrows, OCI.FETCH orientation, OCI.MODE mode) { if (Bid.AdvancedOn) { Bid.Trace("<oc.OCIStmtFetch|ADV|OCI> stmtp=0x%-07Ix errhp=0x%-07Ix nrows=%d orientation=%d{OCI.FETCH}, mode=0x%x{OCI.MODE}\n", stmtp, errhp, nrows, (int) orientation, (int) mode); } int num = System.Data.Common.UnsafeNativeMethods.OCIStmtFetch(stmtp, errhp, (uint) nrows, orientation, mode); if (Bid.AdvancedOn) { Bid.Trace("<oc.OCIStmtFetch|ADV|OCI|RET> rc=%d\n", num); } return num; }
internal static int OCIEnvNlsCreate(out IntPtr envhpp, OCI.MODE mode, ushort charset, ushort ncharset) { if (Bid.AdvancedOn) { Bid.Trace("<oc.OCIEnvNlsCreate|ADV|OCI> mode=0x%x{OCI.MODE} ctxp=0x%-07Ix malocfp=0x%-07Ix ralocfp=0x%-07Ix mfreefp=0x%-07Ix xtramemsz=0x%-07Ix usrmempp=0x%-07Ix charset=%d ncharset=%d", (int) mode, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, charset, ncharset); } int num = System.Data.Common.UnsafeNativeMethods.OCIEnvNlsCreate(out envhpp, mode, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, charset, ncharset); if (Bid.AdvancedOn) { Bid.Trace("<oc.OCIEnvNlsCreate|ADV|OCI|RET> envhpp=0x%-07Ix rc=%d\n", envhpp, num); } return num; }
internal static int OCITransRollback(OciHandle srvhp, OciHandle errhp, OCI.MODE mode) { if (Bid.AdvancedOn) { Bid.Trace("<oc.OCITransRollback|ADV|OCI> srvhp=0x%-07Ix errhp=0x%-07Ix mode=0x%x{OCI.MODE}\n", OciHandle.HandleValueToTrace(srvhp), OciHandle.HandleValueToTrace(errhp), (int) mode); } int num = System.Data.Common.UnsafeNativeMethods.OCITransRollback(srvhp, errhp, mode); if (Bid.AdvancedOn) { Bid.Trace("<oc.OCITransRollback|ADV|OCI|RET> rc=%d\n", num); } return num; }
internal static int OCIHandleAlloc(OciHandle parenth, out IntPtr hndlpp, OCI.HTYPE type) { int num = System.Data.Common.UnsafeNativeMethods.OCIHandleAlloc(parenth, out hndlpp, type, IntPtr.Zero, IntPtr.Zero); if (Bid.AdvancedOn) { Bid.Trace("<oc.OCIHandleAlloc|ADV|OCI|RET> parenth=0x%-07Ix type=%3d xtramemsz=0x%-07Ix usrmempp=0x%-07Ix hndlpp=0x%-07Ix rc=%d\n", parenth, (int) type, IntPtr.Zero, IntPtr.Zero, hndlpp, num); } return num; }
internal static int OCIAttrSet(OciHandle trgthndlp, byte[] attributep, uint size, OCI.ATTR attrtype, OciHandle errhp) { if (Bid.AdvancedOn) { string str; if ((OCI.ATTR.OCI_ATTR_EXTERNAL_NAME == attrtype) || (OCI.ATTR.OCI_ATTR_INTERNAL_NAME == attrtype)) { str = new string(Encoding.UTF8.GetChars(attributep, 0, (int) size)); } else { str = attributep.ToString(); } Bid.Trace("<oc.OCIAttrSet|ADV|OCI> trgthndlp=0x%-07Ix trghndltyp=%-18ls attributep='%ls' size=%d attrtype=%-22ls errhp=0x%-07Ix\n", trgthndlp, trgthndlp.HandleType, str, size, attrtype, errhp); } return System.Data.Common.UnsafeNativeMethods.OCIAttrSet(trgthndlp, trgthndlp.HandleType, attributep, size, attrtype, errhp); }
internal static int OCIHandleFree(IntPtr hndlp, OCI.HTYPE type) { if (Bid.AdvancedOn) { Bid.Trace("<oc.OCIHandleFree|ADV|OCI> hndlp=0x%-07Ix type=%3d\n", hndlp, (int) type); } return System.Data.Common.UnsafeNativeMethods.OCIHandleFree(hndlp, type); }
internal static int MarshalToNative(object value, int offset, int size, NativeBuffer buffer, int bufferOffset, OCI.DATATYPE ociType, bool bindAsUCS2) { string str; string str2; Encoding encoding = bindAsUCS2 ? Encoding.Unicode : Encoding.UTF8; if (value is OracleString) { str = ((OracleString) value)._value; } else { str = (string) value; } if ((offset == 0) && (size == 0)) { str2 = str; } else if ((size == 0) || ((offset + size) > str.Length)) { str2 = str.Substring(offset); } else { str2 = str.Substring(offset, size); } byte[] bytes = encoding.GetBytes(str2); int length = bytes.Length; int num3 = length; if (length != 0) { int num2 = length; if (bindAsUCS2) { num2 /= 2; } if (OCI.DATATYPE.LONGVARCHAR == ociType) { buffer.WriteInt32(bufferOffset, num2); bufferOffset += 4; num3 += 4; } buffer.WriteBytes(bufferOffset, bytes, 0, length); } return num3; }
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); }