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
- OverrideMode.cs
- NativeStructs.cs
- HtmlLink.cs
- MaxValueConverter.cs
- XmlSchemaGroup.cs
- ProcessProtocolHandler.cs
- SqlWebEventProvider.cs
- BoolExpression.cs
- GridViewColumnCollectionChangedEventArgs.cs
- WmlLiteralTextAdapter.cs
- TdsParserSessionPool.cs
- ScrollChrome.cs
- PhoneCall.cs
- ACL.cs
- RulePatternOps.cs
- HttpClientCertificate.cs
- TrackingProfileCache.cs
- StorageModelBuildProvider.cs
- RegisteredExpandoAttribute.cs
- SqlDataReaderSmi.cs
- SqlDataSourceView.cs
- CollectionMarkupSerializer.cs
- LinkButton.cs
- XmlSchemaSimpleContentRestriction.cs
- FontDialog.cs
- ServiceHttpModule.cs
- KeyConstraint.cs
- SortAction.cs
- Color.cs
- RegularExpressionValidator.cs
- XmlnsDefinitionAttribute.cs
- SignatureHelper.cs
- RadioButtonFlatAdapter.cs
- QilUnary.cs
- ReaderWriterLock.cs
- OutputScopeManager.cs
- BitmapEncoder.cs
- ItemsControl.cs
- StringUtil.cs
- DataRowComparer.cs
- SortAction.cs
- ConnectionManagementElementCollection.cs
- OrderByExpression.cs
- Vector3DValueSerializer.cs
- WebBrowsableAttribute.cs
- WSDualHttpSecurityMode.cs
- OrCondition.cs
- RadialGradientBrush.cs
- LessThan.cs
- ExtractCollection.cs
- SurrogateSelector.cs
- SplineKeyFrames.cs
- LightweightCodeGenerator.cs
- LoginCancelEventArgs.cs
- CodeLinePragma.cs
- RawStylusInputCustomDataList.cs
- ButtonRenderer.cs
- CqlParserHelpers.cs
- ParseChildrenAsPropertiesAttribute.cs
- ColumnClickEvent.cs
- CodeDomLoader.cs
- HttpProfileBase.cs
- PageBuildProvider.cs
- HwndTarget.cs
- ReadWriteSpinLock.cs
- Baml2006KeyRecord.cs
- MdImport.cs
- RetrieveVirtualItemEventArgs.cs
- DataProviderNameConverter.cs
- HitTestParameters3D.cs
- KeyTimeConverter.cs
- BaseInfoTable.cs
- PathTooLongException.cs
- WebPartTransformerAttribute.cs
- _ProxyRegBlob.cs
- ViewManager.cs
- FormatConvertedBitmap.cs
- XsltException.cs
- VariableQuery.cs
- CodeAccessPermission.cs
- ZipQueryOperator.cs
- ProfessionalColorTable.cs
- RelationshipConverter.cs
- cookiecontainer.cs
- DataObjectCopyingEventArgs.cs
- FileUpload.cs
- ITreeGenerator.cs
- SystemResourceKey.cs
- ViewManagerAttribute.cs
- SqlStream.cs
- StreamSecurityUpgradeAcceptorAsyncResult.cs
- XmlDocument.cs
- Pair.cs
- AndCondition.cs
- DataServiceRequestException.cs
- PropertyEntry.cs
- Empty.cs
- ItemCheckEvent.cs
- CursorConverter.cs
- EventLogSession.cs