Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / SqlClient / SqlGen / TopClause.cs / 1305376 / TopClause.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....] // @backupOwner [....] //--------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Text; using System.Data.SqlClient; using System.Data.Metadata.Edm; using System.Data.Common.CommandTrees; namespace System.Data.SqlClient.SqlGen { ////// TopClause represents the a TOP expression in a SqlSelectStatement. /// It has a count property, which indicates how many TOP rows should be selected and a /// boolen WithTies property. /// class TopClause : ISqlFragment { ISqlFragment topCount; bool withTies; ////// Do we need to add a WITH_TIES to the top statement /// internal bool WithTies { get { return withTies; } } ////// How many top rows should be selected. /// internal ISqlFragment TopCount { get { return topCount; } } ////// Creates a TopClause with the given topCount and withTies. /// /// /// internal TopClause(ISqlFragment topCount, bool withTies) { this.topCount = topCount; this.withTies = withTies; } ////// Creates a TopClause with the given topCount and withTies. /// /// /// internal TopClause(int topCount, bool withTies) { SqlBuilder sqlBuilder = new SqlBuilder(); sqlBuilder.Append(topCount.ToString(CultureInfo.InvariantCulture)); this.topCount = sqlBuilder; this.withTies = withTies; } #region ISqlFragment Members ////// Write out the TOP part of sql select statement /// It basically writes TOP (X) [WITH TIES]. /// The brackets around X are ommited for Sql8. /// /// /// public void WriteSql(SqlWriter writer, SqlGenerator sqlGenerator) { writer.Write("TOP "); if (sqlGenerator.SqlVersion != SqlVersion.Sql8) { writer.Write("("); } this.TopCount.WriteSql(writer, sqlGenerator); if (sqlGenerator.SqlVersion != SqlVersion.Sql8) { writer.Write(")"); } writer.Write(" "); if (this.WithTies) { writer.Write("WITH TIES "); } } #endregion } } // 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
- ProfileServiceManager.cs
- HttpBufferlessInputStream.cs
- XLinq.cs
- OptimizedTemplateContent.cs
- PingOptions.cs
- InternalDispatchObject.cs
- TemplateAction.cs
- HashStream.cs
- BrushMappingModeValidation.cs
- GroupQuery.cs
- ImageCodecInfo.cs
- TreeNodeMouseHoverEvent.cs
- ListView.cs
- EntitySqlQueryCacheKey.cs
- DataGridViewCellPaintingEventArgs.cs
- FatalException.cs
- FragmentQueryProcessor.cs
- Vector3D.cs
- MaskInputRejectedEventArgs.cs
- Invariant.cs
- COM2FontConverter.cs
- CodeAttachEventStatement.cs
- AlternationConverter.cs
- XmlDocument.cs
- SymLanguageType.cs
- _IPv4Address.cs
- SpeechSynthesizer.cs
- ImagingCache.cs
- ImageBrush.cs
- ValidationResult.cs
- TdsEnums.cs
- ConditionalBranch.cs
- MappingModelBuildProvider.cs
- ProfilePropertySettings.cs
- DeploymentExceptionMapper.cs
- TextPointer.cs
- HostingPreferredMapPath.cs
- CheckoutException.cs
- FillRuleValidation.cs
- SystemWebCachingSectionGroup.cs
- FactoryRecord.cs
- SoapCommonClasses.cs
- RemoteWebConfigurationHostServer.cs
- ListViewItemMouseHoverEvent.cs
- CodeSnippetCompileUnit.cs
- ThreadStartException.cs
- ItemsControl.cs
- ConsoleCancelEventArgs.cs
- SqlClientMetaDataCollectionNames.cs
- Style.cs
- XPathNodeList.cs
- SSmlParser.cs
- ApplicationBuildProvider.cs
- BamlBinaryReader.cs
- Point3DValueSerializer.cs
- Utils.cs
- DesignerActionMethodItem.cs
- Matrix3DStack.cs
- InternalCache.cs
- BaseParser.cs
- ControlDesignerState.cs
- CompilerScope.cs
- LinqDataSourceView.cs
- GcHandle.cs
- VBCodeProvider.cs
- DataSourceProvider.cs
- DataGridViewIntLinkedList.cs
- Variant.cs
- CompleteWizardStep.cs
- DataGridTableCollection.cs
- TextSelectionProcessor.cs
- ToolStripSettings.cs
- SimpleWorkerRequest.cs
- StyleModeStack.cs
- ConfigurationSettings.cs
- precedingquery.cs
- DbgUtil.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- StylusOverProperty.cs
- ADMembershipProvider.cs
- Compilation.cs
- ConstraintEnumerator.cs
- SynchronizationContext.cs
- XmlQueryType.cs
- UInt32.cs
- RadialGradientBrush.cs
- EventEntry.cs
- HiddenFieldPageStatePersister.cs
- XmlSerializerNamespaces.cs
- NotifyIcon.cs
- QueryAsyncResult.cs
- WindowsListView.cs
- InternalDuplexChannelFactory.cs
- SafeSecurityHelper.cs
- SystemEvents.cs
- CodeAccessSecurityEngine.cs
- ThicknessAnimationBase.cs
- UInt32.cs
- SupportingTokenBindingElement.cs
- SocketInformation.cs