Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- Regex.cs
- RegexCompiler.cs
- CodeFieldReferenceExpression.cs
- FileDialogCustomPlace.cs
- SmtpAuthenticationManager.cs
- Guid.cs
- XamlStream.cs
- DynamicMetaObject.cs
- RowVisual.cs
- PageHandlerFactory.cs
- Propagator.ExtentPlaceholderCreator.cs
- ConnectionString.cs
- Model3D.cs
- WaitHandle.cs
- Int64Converter.cs
- Crc32.cs
- CodePrimitiveExpression.cs
- DynamicValueConverter.cs
- BridgeDataReader.cs
- WindowsUserNameSecurityTokenAuthenticator.cs
- PostBackOptions.cs
- StyleSheetDesigner.cs
- CurrentChangingEventManager.cs
- XmlLinkedNode.cs
- TdsEnums.cs
- Logging.cs
- Exceptions.cs
- CapabilitiesUse.cs
- DocumentViewerConstants.cs
- MatrixCamera.cs
- GeneratedCodeAttribute.cs
- NegotiationTokenAuthenticatorState.cs
- BasicCellRelation.cs
- PresentationAppDomainManager.cs
- ListDictionaryInternal.cs
- AnnotationHighlightLayer.cs
- webproxy.cs
- PtsPage.cs
- _NativeSSPI.cs
- iisPickupDirectory.cs
- CodeDirectiveCollection.cs
- SizeChangedInfo.cs
- TextTreeTextElementNode.cs
- ADMembershipUser.cs
- ButtonColumn.cs
- NativeWindow.cs
- TableLayoutSettingsTypeConverter.cs
- TdsParameterSetter.cs
- Parameter.cs
- WindowsContainer.cs
- Rotation3DAnimation.cs
- DbDataReader.cs
- TrustSection.cs
- PrintController.cs
- ChangeInterceptorAttribute.cs
- IfAction.cs
- XamlTypeMapperSchemaContext.cs
- EffectiveValueEntry.cs
- TopClause.cs
- HttpStreamMessage.cs
- OdbcParameterCollection.cs
- Schema.cs
- OracleRowUpdatingEventArgs.cs
- StringWriter.cs
- KeyEvent.cs
- PermissionAttributes.cs
- StylusLogic.cs
- DataGridViewCellStyleChangedEventArgs.cs
- HtmlEncodedRawTextWriter.cs
- DateTimeStorage.cs
- AutomationPatternInfo.cs
- EntityDataSourceQueryBuilder.cs
- TriState.cs
- MSAANativeProvider.cs
- FormParameter.cs
- ConfigUtil.cs
- DataGridViewRowCancelEventArgs.cs
- MatrixAnimationUsingPath.cs
- NameSpaceEvent.cs
- InputReportEventArgs.cs
- WebControlToolBoxItem.cs
- DetailsViewUpdateEventArgs.cs
- AccessViolationException.cs
- TimeEnumHelper.cs
- Utility.cs
- DataControlField.cs
- StringFormat.cs
- ChildrenQuery.cs
- RawStylusInputReport.cs
- ExecutorLocksHeldException.cs
- EntityDataSourceDesigner.cs
- TextTreeUndo.cs
- VisualStyleRenderer.cs
- WebRequest.cs
- SecurityUtils.cs
- SecurityState.cs
- CodeDirectoryCompiler.cs
- ItemsPanelTemplate.cs
- WinEventQueueItem.cs
- ListView.cs