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
- TreeViewCancelEvent.cs
- HttpWebRequestElement.cs
- RuntimeHandles.cs
- PreDigestedSignedInfo.cs
- COM2ICategorizePropertiesHandler.cs
- ThemeDictionaryExtension.cs
- Point3D.cs
- WebPartActionVerb.cs
- WebControl.cs
- TouchDevice.cs
- FormatPage.cs
- DataChangedEventManager.cs
- EqualityComparer.cs
- TypeElement.cs
- GlyphInfoList.cs
- LoginName.cs
- SecurityContextSecurityToken.cs
- CommandEventArgs.cs
- BaseParaClient.cs
- MachineKeyConverter.cs
- UIElement.cs
- IFlowDocumentViewer.cs
- ScriptBehaviorDescriptor.cs
- GenericIdentity.cs
- BitmapInitialize.cs
- XmlImplementation.cs
- ConnectionStringSettingsCollection.cs
- CategoryAttribute.cs
- InstancePersistenceCommand.cs
- TextSelectionHelper.cs
- PolygonHotSpot.cs
- connectionpool.cs
- TextRangeAdaptor.cs
- SectionVisual.cs
- documentation.cs
- ZeroOpNode.cs
- ValidateNames.cs
- ActionFrame.cs
- ColorTranslator.cs
- UnsafeNativeMethods.cs
- IdentifierService.cs
- RotationValidation.cs
- _HeaderInfoTable.cs
- ObjectContext.cs
- PathParser.cs
- GenericParameterDataContract.cs
- TextSelectionHelper.cs
- DocComment.cs
- ProcessingInstructionAction.cs
- HandlerElement.cs
- FileSecurity.cs
- UserControl.cs
- SocketAddress.cs
- ZipIOLocalFileBlock.cs
- ThreadPool.cs
- FormatterServices.cs
- sqlmetadatafactory.cs
- DataGridViewColumnConverter.cs
- CustomAttributeFormatException.cs
- CodeExpressionCollection.cs
- RunClient.cs
- VectorValueSerializer.cs
- SQLSingle.cs
- ParagraphResult.cs
- FamilyMap.cs
- ZoomPercentageConverter.cs
- WebMessageEncodingBindingElement.cs
- ParameterCollection.cs
- SocketAddress.cs
- Module.cs
- CreatingCookieEventArgs.cs
- DesignBindingConverter.cs
- WindowsToolbarAsMenu.cs
- BitFlagsGenerator.cs
- IndependentAnimationStorage.cs
- ListControl.cs
- DataGrid.cs
- MD5CryptoServiceProvider.cs
- SecureConversationServiceCredential.cs
- PlacementWorkspace.cs
- SessionStateModule.cs
- ReadContentAsBinaryHelper.cs
- LogEntrySerializer.cs
- EditorPartChrome.cs
- MachineKeyValidationConverter.cs
- IntegrationExceptionEventArgs.cs
- AddingNewEventArgs.cs
- FileCodeGroup.cs
- CssTextWriter.cs
- MarginsConverter.cs
- StaticContext.cs
- XPathCompileException.cs
- TcpAppDomainProtocolHandler.cs
- TreeBuilder.cs
- XmlMtomWriter.cs
- ParserHooks.cs
- DataGridTablesFactory.cs
- Native.cs
- ByteStorage.cs
- Helper.cs