Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / ndp / fx / src / DataEntity / System / Data / SqlClient / SqlGen / TopClause.cs / 1 / TopClause.cs
//---------------------------------------------------------------------- //// Copyright (c) Microsoft Corporation. All rights reserved. // // // @owner [....], [....] //--------------------------------------------------------------------- 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 [....], [....] //--------------------------------------------------------------------- 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
- MemberAccessException.cs
- TagPrefixAttribute.cs
- AsyncResult.cs
- XmlAggregates.cs
- ColorMap.cs
- MemberCollection.cs
- PrinterResolution.cs
- RepeatInfo.cs
- Events.cs
- Blend.cs
- TemplateLookupAction.cs
- LayoutSettings.cs
- Typography.cs
- _FixedSizeReader.cs
- SubstitutionList.cs
- Cast.cs
- MatrixIndependentAnimationStorage.cs
- PromptBuilder.cs
- ClientSideProviderDescription.cs
- SafeFindHandle.cs
- ExpressionNormalizer.cs
- ZipIOExtraField.cs
- OdbcConnectionStringbuilder.cs
- SQLBytes.cs
- SqlRemoveConstantOrderBy.cs
- PropertyNames.cs
- ToolStripDropDownClosedEventArgs.cs
- EntitySqlQueryBuilder.cs
- HMACSHA512.cs
- XmlSchemaParticle.cs
- BeginEvent.cs
- DBPropSet.cs
- XmlTextReaderImplHelpers.cs
- DbBuffer.cs
- SamlDoNotCacheCondition.cs
- PageHandlerFactory.cs
- HandlerFactoryCache.cs
- NavigationCommands.cs
- CSharpCodeProvider.cs
- RtfToXamlReader.cs
- HostProtectionException.cs
- GroupBox.cs
- OleDbConnectionInternal.cs
- UInt16.cs
- StateItem.cs
- Baml2006Reader.cs
- DataGridToolTip.cs
- ServiceRoute.cs
- ClientOptions.cs
- UnauthorizedWebPart.cs
- MessageBox.cs
- HandlerFactoryCache.cs
- FrameworkContentElement.cs
- SqlRowUpdatedEvent.cs
- TextDecorations.cs
- FileVersionInfo.cs
- AddInIpcChannel.cs
- ContentFileHelper.cs
- ClassValidator.cs
- Message.cs
- IIS7WorkerRequest.cs
- PropertyManager.cs
- ConfigurationPropertyAttribute.cs
- IPPacketInformation.cs
- TablePattern.cs
- serverconfig.cs
- login.cs
- Int32AnimationBase.cs
- WebSysDisplayNameAttribute.cs
- CSharpCodeProvider.cs
- ThreadNeutralSemaphore.cs
- WaitHandle.cs
- GraphicsContext.cs
- DeferredElementTreeState.cs
- DesignerActionUIService.cs
- ServiceOperationParameter.cs
- StorageEntityTypeMapping.cs
- TcpTransportSecurityElement.cs
- KeyFrames.cs
- SimpleModelProvider.cs
- SqlClientWrapperSmiStream.cs
- NestedContainer.cs
- PropertyPath.cs
- DNS.cs
- GenericUriParser.cs
- ValidationSummary.cs
- InheritedPropertyChangedEventArgs.cs
- XXXOnTypeBuilderInstantiation.cs
- XPathNodeInfoAtom.cs
- BackStopAuthenticationModule.cs
- Window.cs
- ClientApiGenerator.cs
- ToolStripComboBox.cs
- FixedHighlight.cs
- SerialPinChanges.cs
- FieldNameLookup.cs
- _AutoWebProxyScriptEngine.cs
- ClientSettingsSection.cs
- XPathAncestorIterator.cs
- GetImportedCardRequest.cs