Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Data / Microsoft / SqlServer / Server / SmiGettersStream.cs / 1305376 / SmiGettersStream.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- namespace Microsoft.SqlServer.Server { using System; using System.Data.Common; using System.Data.SqlClient; using System.IO; using System.Diagnostics; internal class SmiGettersStream : Stream { private SmiEventSink_Default _sink; private ITypedGettersV3 _getters; private int _ordinal; private long _readPosition; private SmiMetaData _metaData; internal SmiGettersStream( SmiEventSink_Default sink, ITypedGettersV3 getters, int ordinal, SmiMetaData metaData ) { Debug.Assert( null != sink ); Debug.Assert( null != getters ); Debug.Assert( 0 <= ordinal ); Debug.Assert( null != metaData ); _sink = sink; _getters = getters; _ordinal = ordinal; _readPosition = 0; _metaData = metaData; } public override bool CanRead { get { return true; } } // If CanSeek is false, Position, Seek, Length, and SetLength should throw. public override bool CanSeek { get { return false; } } public override bool CanWrite { get { return false; } } public override long Length { get { return ValueUtilsSmi.GetBytesInternal( _sink, _getters, _ordinal, _metaData, 0, null, 0, 0, false ); } } public override long Position { get { return _readPosition; } set { throw SQL.StreamSeekNotSupported(); } } public override void Flush() { throw SQL.StreamWriteNotSupported(); } public override long Seek(long offset, SeekOrigin origin) { throw SQL.StreamSeekNotSupported(); } public override void SetLength(long value) { throw SQL.StreamWriteNotSupported(); } public override int Read( byte[] buffer, int offset, int count ) { long bytesRead = ValueUtilsSmi.GetBytesInternal( _sink, _getters, _ordinal, _metaData, _readPosition, buffer, offset, count, false ); _readPosition += bytesRead; return checked( (int) bytesRead ); } public override void Write( byte[] buffer, int offset, int count ) { throw SQL.StreamWriteNotSupported(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //[....] //----------------------------------------------------------------------------- namespace Microsoft.SqlServer.Server { using System; using System.Data.Common; using System.Data.SqlClient; using System.IO; using System.Diagnostics; internal class SmiGettersStream : Stream { private SmiEventSink_Default _sink; private ITypedGettersV3 _getters; private int _ordinal; private long _readPosition; private SmiMetaData _metaData; internal SmiGettersStream( SmiEventSink_Default sink, ITypedGettersV3 getters, int ordinal, SmiMetaData metaData ) { Debug.Assert( null != sink ); Debug.Assert( null != getters ); Debug.Assert( 0 <= ordinal ); Debug.Assert( null != metaData ); _sink = sink; _getters = getters; _ordinal = ordinal; _readPosition = 0; _metaData = metaData; } public override bool CanRead { get { return true; } } // If CanSeek is false, Position, Seek, Length, and SetLength should throw. public override bool CanSeek { get { return false; } } public override bool CanWrite { get { return false; } } public override long Length { get { return ValueUtilsSmi.GetBytesInternal( _sink, _getters, _ordinal, _metaData, 0, null, 0, 0, false ); } } public override long Position { get { return _readPosition; } set { throw SQL.StreamSeekNotSupported(); } } public override void Flush() { throw SQL.StreamWriteNotSupported(); } public override long Seek(long offset, SeekOrigin origin) { throw SQL.StreamSeekNotSupported(); } public override void SetLength(long value) { throw SQL.StreamWriteNotSupported(); } public override int Read( byte[] buffer, int offset, int count ) { long bytesRead = ValueUtilsSmi.GetBytesInternal( _sink, _getters, _ordinal, _metaData, _readPosition, buffer, offset, count, false ); _readPosition += bytesRead; return checked( (int) bytesRead ); } public override void Write( byte[] buffer, int offset, int count ) { throw SQL.StreamWriteNotSupported(); } } } // 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
- selecteditemcollection.cs
- SelfIssuedAuthAsymmetricKey.cs
- SoundPlayer.cs
- SQLByteStorage.cs
- EndpointDiscoveryBehavior.cs
- XmlQueryType.cs
- PermissionSetTriple.cs
- System.Data_BID.cs
- TypeElement.cs
- SizeAnimationClockResource.cs
- InkCanvasSelection.cs
- BuildProvider.cs
- WindowsTokenRoleProvider.cs
- DesignerHost.cs
- UserNameSecurityToken.cs
- GlyphInfoList.cs
- ControlBuilderAttribute.cs
- ProcessHostFactoryHelper.cs
- ProtocolsConfiguration.cs
- GraphicsPath.cs
- NavigationPropertyEmitter.cs
- SqlRewriteScalarSubqueries.cs
- XhtmlBasicTextBoxAdapter.cs
- DiscoveryVersion.cs
- LogicalTreeHelper.cs
- ReferencedType.cs
- PathParser.cs
- NonPrimarySelectionGlyph.cs
- HMACSHA256.cs
- XmlSiteMapProvider.cs
- FixedTextView.cs
- Transform.cs
- _SSPISessionCache.cs
- RelationshipEnd.cs
- SlotInfo.cs
- DataGridViewCellStyle.cs
- PipelineModuleStepContainer.cs
- FixedLineResult.cs
- ProcessModuleCollection.cs
- ConnectionPoint.cs
- ObjectDataSourceSelectingEventArgs.cs
- DataSourceXmlClassAttribute.cs
- ValueChangedEventManager.cs
- HttpGetClientProtocol.cs
- LogAppendAsyncResult.cs
- SQLUtility.cs
- QilChoice.cs
- WebEvents.cs
- IApplicationTrustManager.cs
- ConfigXmlSignificantWhitespace.cs
- XmlExpressionDumper.cs
- SpanIndex.cs
- metadatamappinghashervisitor.cs
- DataKey.cs
- PrintPreviewControl.cs
- ModulesEntry.cs
- StylusTip.cs
- GradientStop.cs
- SynchronizedCollection.cs
- ComponentEvent.cs
- ApplicationDirectoryMembershipCondition.cs
- DispatcherExceptionFilterEventArgs.cs
- Pens.cs
- GraphicsContext.cs
- HttpFileCollection.cs
- objectresult_tresulttype.cs
- View.cs
- Compress.cs
- HttpApplicationFactory.cs
- RedBlackList.cs
- ServerValidateEventArgs.cs
- AddInDeploymentState.cs
- MessageLogTraceRecord.cs
- HttpResponse.cs
- XmlNodeComparer.cs
- GrammarBuilderWildcard.cs
- ConstructorBuilder.cs
- XmlSchemaObjectCollection.cs
- CharKeyFrameCollection.cs
- AdapterSwitches.cs
- unitconverter.cs
- ImageMapEventArgs.cs
- RadialGradientBrush.cs
- ClientSession.cs
- ReadWriteSpinLock.cs
- CorrelationActionMessageFilter.cs
- X500Name.cs
- RowToParametersTransformer.cs
- TimelineGroup.cs
- RolePrincipal.cs
- ObjectDataSource.cs
- BaseDataList.cs
- NumericPagerField.cs
- Errors.cs
- SoapTypeAttribute.cs
- LOSFormatter.cs
- BulletedListEventArgs.cs
- LinqDataSourceDisposeEventArgs.cs
- TreeViewHitTestInfo.cs
- GPRECTF.cs