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
- Avt.cs
- CompilerResults.cs
- KeyInterop.cs
- SafeNativeMethods.cs
- Matrix.cs
- sqlser.cs
- PropertyGridCommands.cs
- ValidationErrorEventArgs.cs
- WebPartCancelEventArgs.cs
- EntityContainerEntitySetDefiningQuery.cs
- WMIGenerator.cs
- CursorConverter.cs
- cookie.cs
- CredentialCache.cs
- DataControlLinkButton.cs
- DataTableClearEvent.cs
- StatusCommandUI.cs
- Matrix.cs
- PluggableProtocol.cs
- OleDbStruct.cs
- LayoutExceptionEventArgs.cs
- GridEntryCollection.cs
- StyleSelector.cs
- OutputCacheProfileCollection.cs
- StrokeCollection2.cs
- TypeHelpers.cs
- WindowHelperService.cs
- EncryptedPackage.cs
- RepeaterItemEventArgs.cs
- GACMembershipCondition.cs
- ProxyFragment.cs
- DynamicQueryStringParameter.cs
- ConditionBrowserDialog.cs
- MruCache.cs
- ToolStripSettings.cs
- FtpCachePolicyElement.cs
- IdentityReference.cs
- HeaderUtility.cs
- PrivateFontCollection.cs
- SqlCrossApplyToCrossJoin.cs
- NeedSkipTokenVisitor.cs
- SessionViewState.cs
- LicFileLicenseProvider.cs
- RewritingSimplifier.cs
- FocusManager.cs
- BuildResult.cs
- ASCIIEncoding.cs
- CodeDomDesignerLoader.cs
- CodeDirectionExpression.cs
- GetReadStreamResult.cs
- XmlAttributeAttribute.cs
- PlacementWorkspace.cs
- Typography.cs
- PrintEvent.cs
- WebServiceTypeData.cs
- XmlDictionaryString.cs
- SecureStringHasher.cs
- OleDbCommand.cs
- ContentIterators.cs
- DetailsViewUpdateEventArgs.cs
- FixedSOMPageElement.cs
- HtmlToClrEventProxy.cs
- DataGridViewSelectedRowCollection.cs
- CodeSubDirectoriesCollection.cs
- CodeTypeParameter.cs
- FileDataSourceCache.cs
- UrlMappingsSection.cs
- AncillaryOps.cs
- MethodCallTranslator.cs
- WebSysDefaultValueAttribute.cs
- ThemeDictionaryExtension.cs
- InputEventArgs.cs
- SynchronizationLockException.cs
- FolderLevelBuildProvider.cs
- XmlSchemaAny.cs
- SqlParameterizer.cs
- IndicShape.cs
- BreakRecordTable.cs
- GroupDescription.cs
- FixedSOMPageConstructor.cs
- ProfileGroupSettingsCollection.cs
- VScrollBar.cs
- SqlAliasesReferenced.cs
- CompositeFontFamily.cs
- DataPagerFieldCommandEventArgs.cs
- Application.cs
- COSERVERINFO.cs
- DataServiceBehavior.cs
- EditorZoneBase.cs
- _FtpControlStream.cs
- BaseConfigurationRecord.cs
- Dictionary.cs
- SqlDataSourceCustomCommandPanel.cs
- AutomationInteropProvider.cs
- DecoderNLS.cs
- BinHexEncoder.cs
- SelectionWordBreaker.cs
- ProbeDuplexAsyncResult.cs
- ConsoleCancelEventArgs.cs
- TextLine.cs