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
- XDeferredAxisSource.cs
- ACL.cs
- ScopelessEnumAttribute.cs
- CommandPlan.cs
- DataControlFieldTypeEditor.cs
- KeyEventArgs.cs
- ResourcesChangeInfo.cs
- CodeAccessPermission.cs
- ObjectIDGenerator.cs
- InkCanvasInnerCanvas.cs
- ADMembershipProvider.cs
- SafeProcessHandle.cs
- SerializationSectionGroup.cs
- DataGridViewTopLeftHeaderCell.cs
- CachedTypeface.cs
- OdbcFactory.cs
- FrameworkElementAutomationPeer.cs
- TransformDescriptor.cs
- SoapServerMethod.cs
- CommandID.cs
- CTreeGenerator.cs
- SafeLibraryHandle.cs
- CustomLineCap.cs
- FontStretches.cs
- NativeActivityAbortContext.cs
- TextWriterTraceListener.cs
- ManagedIStream.cs
- WpfPayload.cs
- SchemaCollectionPreprocessor.cs
- XmlSchemaAny.cs
- FlowLayout.cs
- ProxyWebPart.cs
- SqlServices.cs
- XamlFigureLengthSerializer.cs
- IntranetCredentialPolicy.cs
- Encoding.cs
- Soap12FormatExtensions.cs
- StreamGeometryContext.cs
- Operator.cs
- CodeNamespace.cs
- SqlConnectionPoolProviderInfo.cs
- OracleDataReader.cs
- WebSysDefaultValueAttribute.cs
- SqlReorderer.cs
- ListViewContainer.cs
- FrameAutomationPeer.cs
- Parameter.cs
- WebBrowsableAttribute.cs
- _DynamicWinsockMethods.cs
- QueryConverter.cs
- ResourceSetExpression.cs
- Image.cs
- SiteMapDataSource.cs
- QuerySafeNavigator.cs
- IgnoreDataMemberAttribute.cs
- ButtonColumn.cs
- DataSourceSelectArguments.cs
- SerializationSectionGroup.cs
- CompilerResults.cs
- AppDomainInstanceProvider.cs
- ClientTargetSection.cs
- HMACSHA512.cs
- _Connection.cs
- AttributeCollection.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- TextServicesContext.cs
- EntityViewGenerationConstants.cs
- TemplateXamlTreeBuilder.cs
- StringCollection.cs
- DataGridParentRows.cs
- MobileControlsSectionHandler.cs
- CoTaskMemHandle.cs
- LinkLabelLinkClickedEvent.cs
- PageAdapter.cs
- WebPartMinimizeVerb.cs
- TextEditorParagraphs.cs
- IntPtr.cs
- RadioButtonFlatAdapter.cs
- MsmqAuthenticationMode.cs
- RenderingEventArgs.cs
- FocusManager.cs
- ComboBoxAutomationPeer.cs
- Window.cs
- ControlValuePropertyAttribute.cs
- KeyEvent.cs
- HttpClientCertificate.cs
- ToolCreatedEventArgs.cs
- XmlSchemaComplexContentRestriction.cs
- ColumnMapProcessor.cs
- IERequestCache.cs
- OneOfElement.cs
- PerfCounterSection.cs
- RoleGroupCollection.cs
- DataGridViewCellCancelEventArgs.cs
- CriticalHandle.cs
- SystemIPInterfaceProperties.cs
- MenuEventArgs.cs
- ModuleElement.cs
- XmlName.cs
- GenericUriParser.cs