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
- EntityDataSourceView.cs
- ContentFileHelper.cs
- GlobalizationSection.cs
- JsonFormatReaderGenerator.cs
- GridSplitter.cs
- StandardOleMarshalObject.cs
- ImageFormat.cs
- FlowPosition.cs
- DecoderExceptionFallback.cs
- FirstMatchCodeGroup.cs
- AttributeParameterInfo.cs
- StringUtil.cs
- StringUtil.cs
- WebPartsPersonalization.cs
- Matrix3D.cs
- TextEditorThreadLocalStore.cs
- WorkflowTerminatedException.cs
- IssuanceTokenProviderBase.cs
- DrawingContextWalker.cs
- ReversePositionQuery.cs
- RotationValidation.cs
- Function.cs
- FormatVersion.cs
- IndexOutOfRangeException.cs
- HtmlImage.cs
- IisTraceWebEventProvider.cs
- GridToolTip.cs
- FontCacheLogic.cs
- Quaternion.cs
- EntityContainerEmitter.cs
- ConfigXmlText.cs
- SspiHelper.cs
- TemplateBuilder.cs
- DataObjectCopyingEventArgs.cs
- TimeoutHelper.cs
- WebPartConnectionsConnectVerb.cs
- TextMessageEncoder.cs
- SwitchLevelAttribute.cs
- FrameworkElementFactoryMarkupObject.cs
- OleDbCommand.cs
- SoapElementAttribute.cs
- DependentTransaction.cs
- WebControlParameterProxy.cs
- ReadOnlyCollectionBase.cs
- Rect3D.cs
- XmlTypeAttribute.cs
- WorkflowTraceTransfer.cs
- Rectangle.cs
- RandomDelayQueuedSendsAsyncResult.cs
- InvalidTimeZoneException.cs
- LineMetrics.cs
- CorePropertiesFilter.cs
- AsymmetricSignatureDeformatter.cs
- NumberSubstitution.cs
- VersionPair.cs
- OuterGlowBitmapEffect.cs
- AttributeSetAction.cs
- Propagator.ExtentPlaceholderCreator.cs
- LinqDataSourceEditData.cs
- AppDomainUnloadedException.cs
- ExpandSegmentCollection.cs
- RenameRuleObjectDialog.cs
- QilPatternVisitor.cs
- CollectionViewGroupInternal.cs
- FontInfo.cs
- WorkflowShape.cs
- SocketCache.cs
- EntityViewContainer.cs
- DataTableReaderListener.cs
- MarkedHighlightComponent.cs
- BitmapImage.cs
- TrustManager.cs
- BitmapEffectState.cs
- UnauthorizedAccessException.cs
- PanelStyle.cs
- ControllableStoryboardAction.cs
- ObjectMemberMapping.cs
- PropertyPathConverter.cs
- TreeNodeStyle.cs
- PropertyKey.cs
- Internal.cs
- ActivityDelegate.cs
- XPathNodeInfoAtom.cs
- BamlResourceContent.cs
- HttpHandlersSection.cs
- UnmanagedMarshal.cs
- ToolStripTextBox.cs
- Parsers.cs
- SplitContainer.cs
- XmlSchemaNotation.cs
- XsltLibrary.cs
- Event.cs
- NamespaceEmitter.cs
- COM2ExtendedTypeConverter.cs
- ErrorProvider.cs
- WindowsListViewScroll.cs
- FontDriver.cs
- SystemDiagnosticsSection.cs
- CultureInfoConverter.cs
- BigIntegerStorage.cs