Code:
/ 4.0 / 4.0 / 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. //---------------------------------------------------------------------- //// 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
- Resources.Designer.cs
- PasswordBox.cs
- ToolStripArrowRenderEventArgs.cs
- AlternationConverter.cs
- TagNameToTypeMapper.cs
- BinaryMethodMessage.cs
- MsmqAppDomainProtocolHandler.cs
- TransformedBitmap.cs
- AdornerLayer.cs
- PasswordBoxAutomationPeer.cs
- ConfigXmlText.cs
- updateconfighost.cs
- ImmutableCollection.cs
- CollectionViewGroupRoot.cs
- securitymgrsite.cs
- FileClassifier.cs
- ProgressBar.cs
- SQLMembershipProvider.cs
- TextTreeText.cs
- RegexRunner.cs
- SubtreeProcessor.cs
- ClientOperationFormatterProvider.cs
- Page.cs
- LongSumAggregationOperator.cs
- TemplateBaseAction.cs
- WCFServiceClientProxyGenerator.cs
- ContainerVisual.cs
- JumpPath.cs
- ParameterCollection.cs
- Convert.cs
- TreeWalkHelper.cs
- Triplet.cs
- OleDbParameterCollection.cs
- ApplicationCommands.cs
- pingexception.cs
- sapiproxy.cs
- WebResourceAttribute.cs
- MetadataArtifactLoaderComposite.cs
- DataBoundControlHelper.cs
- ActiveXHelper.cs
- FreezableDefaultValueFactory.cs
- CreationContext.cs
- HttpStreams.cs
- DocumentAutomationPeer.cs
- LayoutTable.cs
- BaseTreeIterator.cs
- SyndicationSerializer.cs
- httpapplicationstate.cs
- BrushValueSerializer.cs
- WindowProviderWrapper.cs
- InfoCardSymmetricAlgorithm.cs
- StreamGeometry.cs
- connectionpool.cs
- QilTernary.cs
- DataServiceContext.cs
- RightsManagementEncryptionTransform.cs
- DeploymentSectionCache.cs
- QuadraticEase.cs
- MemberDomainMap.cs
- MetadataCache.cs
- PageWrapper.cs
- GridViewPageEventArgs.cs
- PersonalizationDictionary.cs
- UnsafeNativeMethodsMilCoreApi.cs
- WeakRefEnumerator.cs
- DataViewSettingCollection.cs
- ReadOnlyHierarchicalDataSourceView.cs
- Crypto.cs
- TraceFilter.cs
- Clipboard.cs
- EndpointIdentity.cs
- WpfPayload.cs
- ReflectionPermission.cs
- ConfigurationManagerInternal.cs
- PageParser.cs
- EnvelopedPkcs7.cs
- SystemIPInterfaceProperties.cs
- DateTimeConverter.cs
- OdbcException.cs
- CookieProtection.cs
- CharacterBufferReference.cs
- SectionVisual.cs
- CollectionBase.cs
- AlternationConverter.cs
- ChangeNode.cs
- BitmapCodecInfo.cs
- IntegerValidatorAttribute.cs
- SafeThreadHandle.cs
- ControlTemplate.cs
- CodeConditionStatement.cs
- DataGridTable.cs
- DataKeyArray.cs
- UriTemplatePathSegment.cs
- LinqDataSourceContextEventArgs.cs
- ISAPIApplicationHost.cs
- WebPart.cs
- SafeRightsManagementEnvironmentHandle.cs
- TextureBrush.cs
- HttpCookiesSection.cs
- TranslateTransform.cs