TempEnvironment.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / DataOracleClient / System / Data / OracleClient / TempEnvironment.cs / 1 / TempEnvironment.cs

                            //------------------------------------------------------------------------------ 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// [....] 
//-----------------------------------------------------------------------------
 
namespace System.Data.OracleClient 
{
    using System; 
    using System.Diagnostics;
    using System.Security;
    using System.Security.Permissions;
 
    //---------------------------------------------------------------------
    // TempEnvironment 
    // 
    //  Temporary Environment, used to get temporary handles so we don't
    //  have to pass the environment handle everywhere. 
    //
    sealed internal class TempEnvironment {
        static private OciEnvironmentHandle     environmentHandle;
        static private OciErrorHandle       availableErrorHandle;       // 
        static private volatile bool             isInitialized;
        static private object           locked = new object(); 
 
        private TempEnvironment() { }
 
        static void Initialize() {
            lock (locked) {
                if (!isInitialized) {
                    bool        unicode = false; 
                    OCI.MODE    environmentMode = (OCI.MODE.OCI_THREADED | OCI.MODE.OCI_OBJECT);    // NOTE: cannot be NO_MUTEX because we might be multi-threaded.
 
                    OCI.DetermineClientVersion(); 

                    //1 



 
        #if NEVER
                    if (OCI.ClientVersionAtLeastOracle9i) { 
                        unicode = true; 
                        environmentMode |= OCI.MODE.OCI_UTF16;
                    } 
        #endif //0
                    environmentHandle       = new OciEnvironmentHandle(environmentMode, unicode);
                    availableErrorHandle    = new OciErrorHandle(environmentHandle);
                    isInitialized = true; 
                }
            } 
        } 

        static internal OciErrorHandle GetErrorHandle() { 
            OracleConnection.VerifyExecutePermission();

            if (!isInitialized) {
                Initialize(); 
            }
            return availableErrorHandle;        // 
        } 
    }
} 


// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------ 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// [....] 
//-----------------------------------------------------------------------------
 
namespace System.Data.OracleClient 
{
    using System; 
    using System.Diagnostics;
    using System.Security;
    using System.Security.Permissions;
 
    //---------------------------------------------------------------------
    // TempEnvironment 
    // 
    //  Temporary Environment, used to get temporary handles so we don't
    //  have to pass the environment handle everywhere. 
    //
    sealed internal class TempEnvironment {
        static private OciEnvironmentHandle     environmentHandle;
        static private OciErrorHandle       availableErrorHandle;       // 
        static private volatile bool             isInitialized;
        static private object           locked = new object(); 
 
        private TempEnvironment() { }
 
        static void Initialize() {
            lock (locked) {
                if (!isInitialized) {
                    bool        unicode = false; 
                    OCI.MODE    environmentMode = (OCI.MODE.OCI_THREADED | OCI.MODE.OCI_OBJECT);    // NOTE: cannot be NO_MUTEX because we might be multi-threaded.
 
                    OCI.DetermineClientVersion(); 

                    //1 



 
        #if NEVER
                    if (OCI.ClientVersionAtLeastOracle9i) { 
                        unicode = true; 
                        environmentMode |= OCI.MODE.OCI_UTF16;
                    } 
        #endif //0
                    environmentHandle       = new OciEnvironmentHandle(environmentMode, unicode);
                    availableErrorHandle    = new OciErrorHandle(environmentHandle);
                    isInitialized = true; 
                }
            } 
        } 

        static internal OciErrorHandle GetErrorHandle() { 
            OracleConnection.VerifyExecutePermission();

            if (!isInitialized) {
                Initialize(); 
            }
            return availableErrorHandle;        // 
        } 
    }
} 


// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK