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
- PackagePartCollection.cs
- AnimationClock.cs
- XmlSchemaParticle.cs
- SettingsBase.cs
- SatelliteContractVersionAttribute.cs
- GenerateTemporaryTargetAssembly.cs
- NamespaceQuery.cs
- SqlCachedBuffer.cs
- HttpRuntime.cs
- __ComObject.cs
- EntitySqlQueryCacheEntry.cs
- DependencyObjectType.cs
- DockPanel.cs
- XmlSchemaType.cs
- OletxResourceManager.cs
- SqlConnectionFactory.cs
- Color.cs
- SmiEventSink.cs
- VisualCollection.cs
- SmiEventSink_DeferedProcessing.cs
- DateTimeParse.cs
- OwnerDrawPropertyBag.cs
- ControlTemplate.cs
- datacache.cs
- DataAdapter.cs
- diagnosticsswitches.cs
- ChannelEndpointElementCollection.cs
- CodeStatement.cs
- SID.cs
- DataGridViewImageColumn.cs
- AnnotationObservableCollection.cs
- CodePageEncoding.cs
- SelectiveScrollingGrid.cs
- DataPointer.cs
- OdbcConnectionHandle.cs
- WebBrowserHelper.cs
- KeyPressEvent.cs
- BuildProvider.cs
- Schema.cs
- ReadOnlyHierarchicalDataSource.cs
- ViewBox.cs
- FlowDocumentReaderAutomationPeer.cs
- CqlIdentifiers.cs
- CornerRadiusConverter.cs
- Condition.cs
- AuthenticodeSignatureInformation.cs
- MimeTextImporter.cs
- XmlSerializerFaultFormatter.cs
- CheckBoxRenderer.cs
- DaylightTime.cs
- SelectedGridItemChangedEvent.cs
- WindowsBrush.cs
- CodeDelegateInvokeExpression.cs
- SupportingTokenChannel.cs
- EntityDataReader.cs
- RelativeSource.cs
- PathData.cs
- CapiNative.cs
- Monitor.cs
- PublisherIdentityPermission.cs
- ProfilePropertySettings.cs
- SubMenuStyleCollectionEditor.cs
- FormViewInsertedEventArgs.cs
- Math.cs
- ListBindableAttribute.cs
- NativeActivity.cs
- DetailsViewRow.cs
- Wildcard.cs
- ZipIOExtraFieldPaddingElement.cs
- AuthenticationConfig.cs
- RawTextInputReport.cs
- RoutingSection.cs
- MLangCodePageEncoding.cs
- RecognizerInfo.cs
- PriorityItem.cs
- Error.cs
- Context.cs
- FlowLayoutPanel.cs
- IDispatchConstantAttribute.cs
- XmlDataSourceView.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- BulletedListEventArgs.cs
- ResourceCategoryAttribute.cs
- WinEventHandler.cs
- Boolean.cs
- CharConverter.cs
- MimeParameter.cs
- ReadOnlyHierarchicalDataSource.cs
- OleDbErrorCollection.cs
- NameScope.cs
- PropertyStore.cs
- InputMethodStateChangeEventArgs.cs
- LostFocusEventManager.cs
- XmlUnspecifiedAttribute.cs
- HandlerFactoryWrapper.cs
- XPathEmptyIterator.cs
- ImageIndexConverter.cs
- ImageMetadata.cs
- OdbcInfoMessageEvent.cs
- PixelShader.cs