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
- OleDbPropertySetGuid.cs
- Int32AnimationBase.cs
- ObjectConverter.cs
- GeometryModel3D.cs
- FigureParaClient.cs
- ContextMenuStrip.cs
- ResXDataNode.cs
- GraphicsPathIterator.cs
- LineSegment.cs
- RunInstallerAttribute.cs
- DataStreams.cs
- DbQueryCommandTree.cs
- Vector3DCollectionValueSerializer.cs
- AppModelKnownContentFactory.cs
- Decoder.cs
- DbConnectionInternal.cs
- ToolboxComponentsCreatedEventArgs.cs
- RegexGroupCollection.cs
- ClientProxyGenerator.cs
- CreateUserWizardAutoFormat.cs
- AppLevelCompilationSectionCache.cs
- Color.cs
- ScriptHandlerFactory.cs
- Transform3DGroup.cs
- RowUpdatingEventArgs.cs
- ContainerCodeDomSerializer.cs
- XmlSchemaComplexType.cs
- ComboBox.cs
- CodeDelegateCreateExpression.cs
- Stylesheet.cs
- BaseDataBoundControl.cs
- LocalServiceSecuritySettings.cs
- ILGenerator.cs
- D3DImage.cs
- LinkConverter.cs
- RegexRunner.cs
- JoinQueryOperator.cs
- MDIWindowDialog.cs
- PersonalizationAdministration.cs
- AnimatedTypeHelpers.cs
- BuildProviderUtils.cs
- QuaternionIndependentAnimationStorage.cs
- QueryCorrelationInitializer.cs
- HashRepartitionStream.cs
- Script.cs
- ColumnWidthChangedEvent.cs
- SystemException.cs
- AnimationTimeline.cs
- AspCompat.cs
- Site.cs
- StaticDataManager.cs
- DBSchemaRow.cs
- ExtendedPropertyDescriptor.cs
- NameValueConfigurationElement.cs
- BooleanFacetDescriptionElement.cs
- XmlTextEncoder.cs
- InputBindingCollection.cs
- VisualProxy.cs
- UIElementAutomationPeer.cs
- Pair.cs
- Membership.cs
- _DomainName.cs
- unsafenativemethodsother.cs
- ThicknessAnimationBase.cs
- ObjectStateManager.cs
- MouseButtonEventArgs.cs
- BinaryCommonClasses.cs
- FrugalMap.cs
- DbInsertCommandTree.cs
- HeaderUtility.cs
- Viewport3DAutomationPeer.cs
- OleDbFactory.cs
- SafeTimerHandle.cs
- ReadWriteSpinLock.cs
- SqlXml.cs
- File.cs
- OrderedDictionary.cs
- XsdValidatingReader.cs
- MsmqInputChannel.cs
- SystemDiagnosticsSection.cs
- CompoundFileIOPermission.cs
- ReferenceService.cs
- Page.cs
- Block.cs
- Workspace.cs
- HtmlDocument.cs
- RemotingSurrogateSelector.cs
- OutputCacheProfile.cs
- DataFormats.cs
- ConfigurationErrorsException.cs
- TypeDescriptor.cs
- ManagedFilter.cs
- HttpInputStream.cs
- DbgCompiler.cs
- nulltextnavigator.cs
- ReadWriteSpinLock.cs
- ToolStripDropDownClosedEventArgs.cs
- ResourceDescriptionAttribute.cs
- WaitHandle.cs
- ConnectionConsumerAttribute.cs