Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- NameScopePropertyAttribute.cs
- DelegatingConfigHost.cs
- VisemeEventArgs.cs
- SqlConnectionPoolGroupProviderInfo.cs
- SqlBooleanizer.cs
- printdlgexmarshaler.cs
- ImageMap.cs
- NameValueConfigurationCollection.cs
- ExpressionWriter.cs
- CacheAxisQuery.cs
- WindowsIPAddress.cs
- EventLogTraceListener.cs
- IUnknownConstantAttribute.cs
- ColorPalette.cs
- ConsumerConnectionPointCollection.cs
- ScopelessEnumAttribute.cs
- SiteMapDataSourceView.cs
- SmiRequestExecutor.cs
- TranslateTransform.cs
- DocumentReferenceCollection.cs
- StrongTypingException.cs
- TextBlockAutomationPeer.cs
- login.cs
- WinFormsSpinner.cs
- Helper.cs
- DataGridViewCellStyle.cs
- ScrollItemPattern.cs
- Typeface.cs
- Misc.cs
- EnumValAlphaComparer.cs
- OperationFormatUse.cs
- UnsafeNativeMethods.cs
- HttpHandlerActionCollection.cs
- ToolStripInSituService.cs
- TemplateBindingExtension.cs
- ListViewInsertedEventArgs.cs
- SqlHelper.cs
- AdCreatedEventArgs.cs
- ProgressBar.cs
- newinstructionaction.cs
- XmlNodeChangedEventManager.cs
- JournalEntryStack.cs
- InternalConfigRoot.cs
- SessionSwitchEventArgs.cs
- ViewManager.cs
- SqlDependencyListener.cs
- HtmlHead.cs
- ThrowOnMultipleAssignment.cs
- CalendarDataBindingHandler.cs
- JavaScriptSerializer.cs
- BasicExpressionVisitor.cs
- WindowsListViewItemCheckBox.cs
- objectresult_tresulttype.cs
- OpacityConverter.cs
- ProcessHost.cs
- EntityDataSourceMemberPath.cs
- MulticastIPAddressInformationCollection.cs
- RegexCode.cs
- KeyInstance.cs
- MethodBuilder.cs
- SiteOfOriginContainer.cs
- SaveWorkflowCommand.cs
- Executor.cs
- ClipboardData.cs
- DBDataPermission.cs
- SafeFileHandle.cs
- HttpAsyncResult.cs
- TdsParserSessionPool.cs
- EmptyControlCollection.cs
- SqlLiftIndependentRowExpressions.cs
- InvalidateEvent.cs
- KerberosRequestorSecurityToken.cs
- StructuralCache.cs
- ClientBuildManager.cs
- TypeElement.cs
- TranslateTransform3D.cs
- EventLogPermission.cs
- KeyedCollection.cs
- LocalFileSettingsProvider.cs
- PermissionRequestEvidence.cs
- ReferentialConstraintRoleElement.cs
- XamlReader.cs
- securitycriticaldataClass.cs
- CryptoApi.cs
- GlobalItem.cs
- ObjectHandle.cs
- AdRotator.cs
- StandardBindingCollectionElement.cs
- MSAAEventDispatcher.cs
- ContextProperty.cs
- UserNameSecurityTokenAuthenticator.cs
- DbMetaDataCollectionNames.cs
- ScriptRegistrationManager.cs
- KeyboardNavigation.cs
- FontInfo.cs
- EditorPart.cs
- HandlerElementCollection.cs
- Transform3DCollection.cs
- SqlCacheDependencyDatabaseCollection.cs
- DataShape.cs