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
- GridPattern.cs
- IntSecurity.cs
- RewritingSimplifier.cs
- Component.cs
- SoapSchemaImporter.cs
- Double.cs
- BindingObserver.cs
- BrushConverter.cs
- DesignerObject.cs
- ParallelTimeline.cs
- UriSection.cs
- UnsafeNativeMethods.cs
- MsmqOutputSessionChannel.cs
- BaseTypeViewSchema.cs
- Rotation3D.cs
- WindowsToolbarAsMenu.cs
- PointAnimationBase.cs
- TextServicesDisplayAttribute.cs
- BuildManagerHost.cs
- LambdaCompiler.Statements.cs
- XmlDictionaryReader.cs
- PersianCalendar.cs
- Regex.cs
- TypeExtension.cs
- ViewCellSlot.cs
- EventBuilder.cs
- ListViewPagedDataSource.cs
- PointKeyFrameCollection.cs
- InfoCardTraceRecord.cs
- AssemblyUtil.cs
- HighContrastHelper.cs
- WebPartEventArgs.cs
- ChangeNode.cs
- CollectionDataContractAttribute.cs
- ZipIOExtraFieldZip64Element.cs
- LoadedEvent.cs
- xmlsaver.cs
- PriorityQueue.cs
- ProcessThread.cs
- SigningProgress.cs
- WebErrorHandler.cs
- hresults.cs
- Documentation.cs
- ReaderContextStackData.cs
- DateTimeFormatInfo.cs
- ModuleElement.cs
- EncryptedData.cs
- ViewgenContext.cs
- CaseInsensitiveHashCodeProvider.cs
- UrlMappingCollection.cs
- TraceSwitch.cs
- CursorConverter.cs
- HotSpotCollection.cs
- BinHexEncoder.cs
- ThemeableAttribute.cs
- InputBindingCollection.cs
- ReaderWriterLock.cs
- LambdaCompiler.Logical.cs
- LinqDataSourceDisposeEventArgs.cs
- XamlHostingConfiguration.cs
- TypeRestriction.cs
- CacheAxisQuery.cs
- CodeAttributeArgument.cs
- SecurityTokenParametersEnumerable.cs
- InvalidPropValue.cs
- UnsafeNativeMethods.cs
- UnsafeNativeMethods.cs
- GroupBoxRenderer.cs
- CodeGotoStatement.cs
- CodeBinaryOperatorExpression.cs
- StorageModelBuildProvider.cs
- GuidTagList.cs
- ParameterSubsegment.cs
- SubMenuStyleCollection.cs
- EntitySqlQueryCacheEntry.cs
- InvalidEnumArgumentException.cs
- PerformanceCounterPermissionAttribute.cs
- ApplicationProxyInternal.cs
- TemplatePropertyEntry.cs
- DbgUtil.cs
- AuthenticateEventArgs.cs
- ContentPlaceHolder.cs
- EditorZoneDesigner.cs
- MeshGeometry3D.cs
- hwndwrapper.cs
- TemplateControlCodeDomTreeGenerator.cs
- shaper.cs
- TextPointer.cs
- ThemeConfigurationDialog.cs
- ImplicitInputBrush.cs
- WindowsScrollBar.cs
- StorageMappingItemCollection.cs
- Converter.cs
- NavigationProgressEventArgs.cs
- SqlBulkCopyColumnMapping.cs
- PrivilegeNotHeldException.cs
- ConstructorExpr.cs
- Zone.cs
- TextBoxBaseDesigner.cs
- DateBoldEvent.cs