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
- MessagePartProtectionMode.cs
- RtfFormatStack.cs
- ObjectAnimationBase.cs
- CodeValidator.cs
- TextModifierScope.cs
- XmlUnspecifiedAttribute.cs
- StorageInfo.cs
- ArrayItemValue.cs
- ToolStripHighContrastRenderer.cs
- TimeoutHelper.cs
- Pen.cs
- TextEndOfParagraph.cs
- CharKeyFrameCollection.cs
- XmlAggregates.cs
- TextDecorationCollection.cs
- Context.cs
- IntSecurity.cs
- DataGridColumnStyleMappingNameEditor.cs
- DecoderFallback.cs
- LogArchiveSnapshot.cs
- Assembly.cs
- LogicalTreeHelper.cs
- ArraySet.cs
- UrlPropertyAttribute.cs
- WebPartHeaderCloseVerb.cs
- QEncodedStream.cs
- NotificationContext.cs
- Cloud.cs
- WebColorConverter.cs
- DocumentEventArgs.cs
- SymDocumentType.cs
- DbSource.cs
- SemanticResolver.cs
- TableRowsCollectionEditor.cs
- SessionStateUtil.cs
- MemoryStream.cs
- BinHexDecoder.cs
- DetailsViewPageEventArgs.cs
- DataControlFieldCollection.cs
- TimeSpanConverter.cs
- HwndProxyElementProvider.cs
- GradientStopCollection.cs
- DataRecordInfo.cs
- RotateTransform3D.cs
- SimpleLine.cs
- WebPartConnectionsConnectVerb.cs
- DataGridViewComboBoxEditingControl.cs
- StrokeNodeData.cs
- RectangleHotSpot.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- SoapIncludeAttribute.cs
- ThousandthOfEmRealPoints.cs
- HtmlElementEventArgs.cs
- TriggerBase.cs
- MsmqOutputMessage.cs
- CachedCompositeFamily.cs
- Visual3DCollection.cs
- MeasureData.cs
- VoiceInfo.cs
- _StreamFramer.cs
- ProfilePropertySettingsCollection.cs
- ActiveDocumentEvent.cs
- CompositeActivityValidator.cs
- ListBoxItemAutomationPeer.cs
- PrefixQName.cs
- ProviderUtil.cs
- SerializationFieldInfo.cs
- Stream.cs
- CompModSwitches.cs
- XmlEnumAttribute.cs
- CmsInterop.cs
- TraceSource.cs
- SerialStream.cs
- WebPartConnectionsCloseVerb.cs
- DebugInfoGenerator.cs
- BaseComponentEditor.cs
- DeviceFiltersSection.cs
- RequestResizeEvent.cs
- Int16Storage.cs
- _ConnectStream.cs
- XmlChildEnumerator.cs
- CultureInfo.cs
- ToolStripLabel.cs
- InvalidAsynchronousStateException.cs
- RelationshipNavigation.cs
- OleDbConnectionFactory.cs
- followingsibling.cs
- SerializationSectionGroup.cs
- ListBindableAttribute.cs
- COM2EnumConverter.cs
- SafeFindHandle.cs
- SyntaxCheck.cs
- XamlToRtfParser.cs
- ICspAsymmetricAlgorithm.cs
- EmissiveMaterial.cs
- EventSinkActivityDesigner.cs
- ListViewItemSelectionChangedEvent.cs
- LoginDesigner.cs
- SystemThemeKey.cs
- NetMsmqSecurity.cs