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
- ellipse.cs
- MetadataArtifactLoader.cs
- ComponentDispatcherThread.cs
- AppDomainUnloadedException.cs
- BindingNavigator.cs
- EmbeddedMailObject.cs
- httpserverutility.cs
- StyleSelector.cs
- DataGridViewComboBoxColumnDesigner.cs
- SiteMap.cs
- TransformerInfo.cs
- BadImageFormatException.cs
- ToolStripScrollButton.cs
- SchemaAttDef.cs
- Constraint.cs
- SiteOfOriginPart.cs
- AssemblyHash.cs
- Group.cs
- ToolStripTextBox.cs
- ScrollBarRenderer.cs
- SQlBooleanStorage.cs
- InvalidOleVariantTypeException.cs
- CommonDialog.cs
- OperationCanceledException.cs
- ProcessStartInfo.cs
- NamedPipeTransportSecurity.cs
- Crypto.cs
- VarRefManager.cs
- InvalidDataException.cs
- ToolStripDropTargetManager.cs
- NameObjectCollectionBase.cs
- ScrollPattern.cs
- WebDescriptionAttribute.cs
- UdpTransportSettings.cs
- EntityDataSourceSelectedEventArgs.cs
- RegistryPermission.cs
- SafeCryptHandles.cs
- SQLDecimal.cs
- GridProviderWrapper.cs
- SQLBytesStorage.cs
- Pointer.cs
- WebBrowserSiteBase.cs
- ToolStripArrowRenderEventArgs.cs
- MobileCapabilities.cs
- ManagedWndProcTracker.cs
- FastEncoderWindow.cs
- FontFamily.cs
- BrowserDefinitionCollection.cs
- Int64Storage.cs
- SystemParameters.cs
- PolicyVersionConverter.cs
- DataPointer.cs
- DiagnosticStrings.cs
- Typeface.cs
- localization.cs
- XmlAtomicValue.cs
- ParameterSubsegment.cs
- ColorBuilder.cs
- SqlXml.cs
- Int32Converter.cs
- ParentQuery.cs
- TextEndOfSegment.cs
- TimeoutException.cs
- PostBackOptions.cs
- UnsafeNativeMethodsPenimc.cs
- SessionEndingEventArgs.cs
- LineBreakRecord.cs
- URLAttribute.cs
- ServicePoint.cs
- DispatcherHookEventArgs.cs
- WeakReferenceKey.cs
- ThreadExceptionDialog.cs
- EnvironmentPermission.cs
- ScriptIgnoreAttribute.cs
- MulticastOption.cs
- DataGridViewCellStateChangedEventArgs.cs
- XmlCharCheckingReader.cs
- StyleTypedPropertyAttribute.cs
- CompiledQuery.cs
- DateTimeUtil.cs
- TextParentUndoUnit.cs
- TextServicesCompartmentContext.cs
- SequentialUshortCollection.cs
- AppDomainManager.cs
- DBParameter.cs
- HttpResponseHeader.cs
- ToolTip.cs
- Pair.cs
- BitmapImage.cs
- AuthenticationConfig.cs
- AttachedAnnotationChangedEventArgs.cs
- AuthorizationContext.cs
- VirtualPath.cs
- FormatterServices.cs
- HostingMessageProperty.cs
- TransactedReceiveScope.cs
- HttpNamespaceReservationInstallComponent.cs
- MasterPageBuildProvider.cs
- ContextProperty.cs
- XPathPatternBuilder.cs