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
- XmlValidatingReaderImpl.cs
- WorkerRequest.cs
- newitemfactory.cs
- ClrProviderManifest.cs
- Int32CollectionConverter.cs
- Model3DCollection.cs
- SourceFileBuildProvider.cs
- EntityProxyTypeInfo.cs
- XPathMultyIterator.cs
- NameSpaceEvent.cs
- LineBreakRecord.cs
- MessageBox.cs
- DataGridViewSelectedColumnCollection.cs
- DynamicILGenerator.cs
- ExpressionBuilderCollection.cs
- _ProxyChain.cs
- CatalogPartDesigner.cs
- SoapAttributes.cs
- WhiteSpaceTrimStringConverter.cs
- DocumentApplicationJournalEntry.cs
- Baml2006ReaderFrame.cs
- XmlReaderSettings.cs
- RoleManagerEventArgs.cs
- ComponentChangedEvent.cs
- ColumnProvider.cs
- RepeatInfo.cs
- SimpleFieldTemplateUserControl.cs
- login.cs
- Misc.cs
- PreloadedPackages.cs
- FormatConvertedBitmap.cs
- safex509handles.cs
- ProfileEventArgs.cs
- XmlSchemas.cs
- ListViewDeleteEventArgs.cs
- StylusButtonEventArgs.cs
- NetworkInformationException.cs
- ImmutableClientRuntime.cs
- SymbolType.cs
- BaseCollection.cs
- UnhandledExceptionEventArgs.cs
- GregorianCalendar.cs
- IncrementalCompileAnalyzer.cs
- DataGridCellInfo.cs
- SqlDataSourceQueryEditorForm.cs
- DynamicDocumentPaginator.cs
- MorphHelper.cs
- Vector3DAnimation.cs
- StartUpEventArgs.cs
- ChannelPoolSettings.cs
- SafeViewOfFileHandle.cs
- ActivityValidationServices.cs
- ComponentResourceKey.cs
- XmlAttributes.cs
- DataSourceControl.cs
- OleDbException.cs
- SerializableAttribute.cs
- OdbcConnectionHandle.cs
- Activator.cs
- XmlILCommand.cs
- ProxyWebPart.cs
- ConfigurationSchemaErrors.cs
- DropDownList.cs
- FigureParaClient.cs
- AsyncCompletedEventArgs.cs
- XmlWrappingWriter.cs
- ExpressionConverter.cs
- DynamicRendererThreadManager.cs
- StateManagedCollection.cs
- PropertyCollection.cs
- SelectedGridItemChangedEvent.cs
- RijndaelManagedTransform.cs
- Span.cs
- XamlToRtfParser.cs
- DataTableTypeConverter.cs
- RepeaterDataBoundAdapter.cs
- XsltLoader.cs
- FormViewUpdateEventArgs.cs
- WeakRefEnumerator.cs
- DocumentGrid.cs
- UnsafeMethods.cs
- WizardStepCollectionEditor.cs
- SmtpLoginAuthenticationModule.cs
- StdValidatorsAndConverters.cs
- ActivityCodeDomSerializationManager.cs
- PageSettings.cs
- FileDialogPermission.cs
- SchemaCollectionPreprocessor.cs
- PageTheme.cs
- DeploymentExceptionMapper.cs
- GlyphManager.cs
- Solver.cs
- Freezable.cs
- FilteredXmlReader.cs
- DataGridColumnHeaderItemAutomationPeer.cs
- CodeAccessSecurityEngine.cs
- EmptyEnumerator.cs
- ProcessModuleCollection.cs
- TextDocumentView.cs
- ApplicationHost.cs