Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- XmlSchemaSet.cs
- TypeExtensionSerializer.cs
- MatcherBuilder.cs
- arc.cs
- DiscardableAttribute.cs
- SqlUtil.cs
- TdsEnums.cs
- FrameSecurityDescriptor.cs
- XmlIncludeAttribute.cs
- DownloadProgressEventArgs.cs
- GlyphManager.cs
- EmissiveMaterial.cs
- WindowsTitleBar.cs
- MeshGeometry3D.cs
- DbConnectionOptions.cs
- UpdateTranslator.cs
- DoubleLink.cs
- SchemaImporterExtension.cs
- DynamicValueConverter.cs
- BitmapDecoder.cs
- XmlArrayItemAttribute.cs
- PeerMaintainer.cs
- ServiceOperationWrapper.cs
- PrincipalPermission.cs
- ChtmlCalendarAdapter.cs
- ConditionCollection.cs
- SystemIPInterfaceStatistics.cs
- DescendantBaseQuery.cs
- ScrollBarRenderer.cs
- CodeDomSerializer.cs
- DesignerTransaction.cs
- Process.cs
- EditorPartChrome.cs
- CounterCreationDataConverter.cs
- PartialCachingControl.cs
- SourceFileBuildProvider.cs
- OpenFileDialog.cs
- RawKeyboardInputReport.cs
- WebHttpBindingCollectionElement.cs
- CqlIdentifiers.cs
- SQLDoubleStorage.cs
- ProcessThreadCollection.cs
- DataGridLinkButton.cs
- NeutralResourcesLanguageAttribute.cs
- EventProxy.cs
- BrowserCapabilitiesCodeGenerator.cs
- ApplicationBuildProvider.cs
- DeclarationUpdate.cs
- UTF8Encoding.cs
- ListCollectionView.cs
- SQLUtility.cs
- AuthenticationConfig.cs
- InvalidProgramException.cs
- BrowserCapabilitiesFactoryBase.cs
- GeometryDrawing.cs
- _DigestClient.cs
- ByteConverter.cs
- X509RawDataKeyIdentifierClause.cs
- PersonalizationStateInfoCollection.cs
- TreeNodeBindingCollection.cs
- Calendar.cs
- ClientProxyGenerator.cs
- EntityContainer.cs
- GeometryHitTestResult.cs
- HasActivatableWorkflowEvent.cs
- ToolStripProgressBar.cs
- WebPartAddingEventArgs.cs
- OdbcConnectionOpen.cs
- SQLChars.cs
- MetadataItem.cs
- MessageSecurityOverTcp.cs
- DependencyPropertyKey.cs
- ContainerFilterService.cs
- UntypedNullExpression.cs
- SafeFileMapViewHandle.cs
- OverflowException.cs
- DbConnectionHelper.cs
- SingleTagSectionHandler.cs
- ACL.cs
- Floater.cs
- SchemaImporter.cs
- TypedTableBase.cs
- LinkTarget.cs
- TreeNode.cs
- ObjectStateEntryDbDataRecord.cs
- RelationalExpressions.cs
- ScrollContentPresenter.cs
- ChannelPoolSettings.cs
- CodeAttributeDeclaration.cs
- GridViewCellAutomationPeer.cs
- Matrix3D.cs
- XmlAnyAttributeAttribute.cs
- DragCompletedEventArgs.cs
- ADMembershipUser.cs
- HandledMouseEvent.cs
- SelectionChangedEventArgs.cs
- Expander.cs
- OdbcFactory.cs
- printdlgexmarshaler.cs
- MediaElement.cs