Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Data / Microsoft / SqlServer / Server / SmiGettersStream.cs / 1 / 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
- EntityDataSource.cs
- WorkflowApplicationUnloadedException.cs
- Scalars.cs
- ExpandCollapsePattern.cs
- Closure.cs
- Simplifier.cs
- DES.cs
- LocatorBase.cs
- DSACryptoServiceProvider.cs
- FixedSOMFixedBlock.cs
- IdleTimeoutMonitor.cs
- Stack.cs
- XmlILStorageConverter.cs
- VersionValidator.cs
- AutomationPropertyInfo.cs
- ContourSegment.cs
- Clock.cs
- SystemFonts.cs
- DataGridViewTopRowAccessibleObject.cs
- Formatter.cs
- autovalidator.cs
- UriTemplateTableMatchCandidate.cs
- ValueOfAction.cs
- AssemblyCollection.cs
- PresentationAppDomainManager.cs
- ProxyManager.cs
- SingleAnimationBase.cs
- ExtensionSimplifierMarkupObject.cs
- UIElementCollection.cs
- Int64.cs
- TextLineResult.cs
- AxHost.cs
- XmlILIndex.cs
- ExtensionQuery.cs
- SmiEventSink.cs
- safemediahandle.cs
- JsonUriDataContract.cs
- DaylightTime.cs
- SmtpLoginAuthenticationModule.cs
- InteropAutomationProvider.cs
- DLinqAssociationProvider.cs
- IndentedTextWriter.cs
- Input.cs
- SqlBooleanMismatchVisitor.cs
- PropagatorResult.cs
- RoutedUICommand.cs
- DataStreams.cs
- TaiwanCalendar.cs
- NullReferenceException.cs
- SystemWebCachingSectionGroup.cs
- CustomAttribute.cs
- SolidColorBrush.cs
- ArcSegment.cs
- RoutedPropertyChangedEventArgs.cs
- PeerChannelListener.cs
- EDesignUtil.cs
- CodeTypeMemberCollection.cs
- XmlSchemaObject.cs
- TextTreeInsertElementUndoUnit.cs
- SignatureGenerator.cs
- CompositeFontInfo.cs
- SelectiveScrollingGrid.cs
- ISAPIApplicationHost.cs
- GrammarBuilderPhrase.cs
- DataListItemEventArgs.cs
- Parallel.cs
- RemotingConfigParser.cs
- recordstatescratchpad.cs
- Parameter.cs
- EntityCodeGenerator.cs
- COM2PropertyBuilderUITypeEditor.cs
- ElementAction.cs
- PKCS1MaskGenerationMethod.cs
- AggregateNode.cs
- AsyncStreamReader.cs
- WSSecurityOneDotZeroReceiveSecurityHeader.cs
- KeyEvent.cs
- Subordinate.cs
- TdsParserSafeHandles.cs
- QueryOptionExpression.cs
- ConnectionManagementElement.cs
- FormatException.cs
- DataControlReferenceCollection.cs
- sqlpipe.cs
- WebPartPersonalization.cs
- EventTrigger.cs
- DropAnimation.xaml.cs
- Drawing.cs
- CounterSample.cs
- Light.cs
- XhtmlBasicLabelAdapter.cs
- XmlWriter.cs
- DataGridColumnHeadersPresenterAutomationPeer.cs
- StickyNoteContentControl.cs
- ObjectPersistData.cs
- PropertyTabAttribute.cs
- DoubleKeyFrameCollection.cs
- CompModSwitches.cs
- TextSerializer.cs
- HostExecutionContextManager.cs