Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Data / System / Data / Odbc / OdbcEnvironmentHandle.cs / 1305376 / OdbcEnvironmentHandle.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Data.Common; using System.Diagnostics; using System.Globalization; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading; using System.Runtime.Versioning; namespace System.Data.Odbc { sealed internal class OdbcEnvironmentHandle : OdbcHandle { // SxS: this method uses SQLSetEnvAttr to setup ODBC environment handle settings. Environment handle is safe in SxS. [ResourceExposure(ResourceScope.None)] [ResourceConsumption(ResourceScope.Process, ResourceScope.Process)] internal OdbcEnvironmentHandle() : base(ODBC32.SQL_HANDLE.ENV, null) { ODBC32.RetCode retcode; //Set the expected driver manager version // retcode = UnsafeNativeMethods.SQLSetEnvAttr( this, ODBC32.SQL_ATTR.ODBC_VERSION, ODBC32.SQL_OV_ODBC3, ODBC32.SQL_IS.INTEGER); // ignore retcode //Turn on connection pooling //Note: the env handle controls pooling. Only those connections created under that //handle are pooled. So we have to keep it alive and not create a new environment //for every connection. // retcode = UnsafeNativeMethods.SQLSetEnvAttr( this, ODBC32.SQL_ATTR.CONNECTION_POOLING, ODBC32.SQL_CP_ONE_PER_HENV, ODBC32.SQL_IS.INTEGER); switch(retcode) { case ODBC32.RetCode.SUCCESS: case ODBC32.RetCode.SUCCESS_WITH_INFO: break; default: Dispose(); throw ODBC.CantEnableConnectionpooling(retcode); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Data.Common; using System.Diagnostics; using System.Globalization; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading; using System.Runtime.Versioning; namespace System.Data.Odbc { sealed internal class OdbcEnvironmentHandle : OdbcHandle { // SxS: this method uses SQLSetEnvAttr to setup ODBC environment handle settings. Environment handle is safe in SxS. [ResourceExposure(ResourceScope.None)] [ResourceConsumption(ResourceScope.Process, ResourceScope.Process)] internal OdbcEnvironmentHandle() : base(ODBC32.SQL_HANDLE.ENV, null) { ODBC32.RetCode retcode; //Set the expected driver manager version // retcode = UnsafeNativeMethods.SQLSetEnvAttr( this, ODBC32.SQL_ATTR.ODBC_VERSION, ODBC32.SQL_OV_ODBC3, ODBC32.SQL_IS.INTEGER); // ignore retcode //Turn on connection pooling //Note: the env handle controls pooling. Only those connections created under that //handle are pooled. So we have to keep it alive and not create a new environment //for every connection. // retcode = UnsafeNativeMethods.SQLSetEnvAttr( this, ODBC32.SQL_ATTR.CONNECTION_POOLING, ODBC32.SQL_CP_ONE_PER_HENV, ODBC32.SQL_IS.INTEGER); switch(retcode) { case ODBC32.RetCode.SUCCESS: case ODBC32.RetCode.SUCCESS_WITH_INFO: break; default: Dispose(); throw ODBC.CantEnableConnectionpooling(retcode); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ExpressionBuilderCollection.cs
- ObjectStateEntryOriginalDbUpdatableDataRecord.cs
- EventTrigger.cs
- InputGestureCollection.cs
- X509Utils.cs
- RectangleF.cs
- XmlIterators.cs
- HandlerBase.cs
- DataRelationPropertyDescriptor.cs
- Token.cs
- FormatControl.cs
- ScriptResourceInfo.cs
- AutomationPeer.cs
- ListControlConvertEventArgs.cs
- RoutedEvent.cs
- InternalDispatchObject.cs
- ConstraintStruct.cs
- MetadataCache.cs
- RotateTransform3D.cs
- SourceElementsCollection.cs
- WebBodyFormatMessageProperty.cs
- HttpListenerContext.cs
- Int64AnimationBase.cs
- TextTreeTextElementNode.cs
- InvalidPrinterException.cs
- RsaSecurityTokenAuthenticator.cs
- FederatedMessageSecurityOverHttpElement.cs
- DocumentViewerHelper.cs
- SoapSchemaExporter.cs
- DocumentViewerHelper.cs
- PropertyDescriptorGridEntry.cs
- SupportingTokenAuthenticatorSpecification.cs
- PerformanceCounter.cs
- DataFormats.cs
- Visitor.cs
- CodeCommentStatement.cs
- Utils.cs
- MethodCallTranslator.cs
- CompletionProxy.cs
- Content.cs
- SuppressMergeCheckAttribute.cs
- Encoding.cs
- OwnerDrawPropertyBag.cs
- RegexGroupCollection.cs
- Base64Decoder.cs
- SqlDataSourceTableQuery.cs
- HttpResponseHeader.cs
- OledbConnectionStringbuilder.cs
- HandlerBase.cs
- DateTimePicker.cs
- ClientBuildManagerCallback.cs
- WebPageTraceListener.cs
- TimeSpanConverter.cs
- OrderByBuilder.cs
- DataGridViewDataErrorEventArgs.cs
- XmlParserContext.cs
- InputMethodStateTypeInfo.cs
- ControlParameter.cs
- ELinqQueryState.cs
- ConfigurationCollectionAttribute.cs
- SecurityCriticalDataForSet.cs
- HGlobalSafeHandle.cs
- ObjectStateEntryOriginalDbUpdatableDataRecord.cs
- Internal.cs
- BooleanStorage.cs
- InternalsVisibleToAttribute.cs
- PeerResolver.cs
- TaskFactory.cs
- PropertyItem.cs
- DeferredElementTreeState.cs
- GridViewSortEventArgs.cs
- MenuTracker.cs
- FontFamily.cs
- FormsAuthenticationUserCollection.cs
- ListViewInsertEventArgs.cs
- DataGridViewColumnDesignTimeVisibleAttribute.cs
- HMACSHA512.cs
- RemotingConfigParser.cs
- ReadOnlyNameValueCollection.cs
- HtmlTableRowCollection.cs
- XmlObjectSerializerReadContextComplexJson.cs
- Formatter.cs
- Keyboard.cs
- RegexCharClass.cs
- PersonalizableTypeEntry.cs
- EdgeProfileValidation.cs
- WebPartAuthorizationEventArgs.cs
- TextTreeText.cs
- GlyphingCache.cs
- PerformanceCounterScope.cs
- ResourceWriter.cs
- HMACSHA1.cs
- ValidationEventArgs.cs
- Range.cs
- InkCanvas.cs
- Convert.cs
- TreeViewDesigner.cs
- HtmlWindow.cs
- MappingMetadataHelper.cs
- ServiceHostingEnvironment.cs