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
- RedistVersionInfo.cs
- WebPartConnectionsConfigureVerb.cs
- HttpApplicationFactory.cs
- CommandField.cs
- SizeLimitedCache.cs
- CodeSubDirectory.cs
- MetadataCache.cs
- WsdlImporter.cs
- XmlCDATASection.cs
- ClientRuntimeConfig.cs
- ListItemParagraph.cs
- TickBar.cs
- Model3DGroup.cs
- TextElementEnumerator.cs
- AutomationEventArgs.cs
- PointAnimationUsingKeyFrames.cs
- TagPrefixAttribute.cs
- XmlSchemaParticle.cs
- EntityModelSchemaGenerator.cs
- DateTimeParse.cs
- TransactionsSectionGroup.cs
- WsatServiceCertificate.cs
- StringToken.cs
- WindowsFormsLinkLabel.cs
- WebPartEventArgs.cs
- CapacityStreamGeometryContext.cs
- PersonalizationDictionary.cs
- Peer.cs
- OdbcConnectionStringbuilder.cs
- PersonalizationProvider.cs
- UnknownBitmapDecoder.cs
- FlowNode.cs
- SchemaSetCompiler.cs
- WorkerRequest.cs
- StrokeSerializer.cs
- DesignerObject.cs
- XmlExceptionHelper.cs
- CodeMemberField.cs
- HttpContextBase.cs
- MessageSmuggler.cs
- XmlUnspecifiedAttribute.cs
- FixedDSBuilder.cs
- BindingList.cs
- WpfPayload.cs
- PrintDialog.cs
- Compiler.cs
- CodeDOMProvider.cs
- WCFBuildProvider.cs
- BooleanExpr.cs
- WebPartZoneCollection.cs
- AnchorEditor.cs
- CodeCommentStatementCollection.cs
- TextPointerBase.cs
- Parser.cs
- LinqDataSourceHelper.cs
- BinaryWriter.cs
- PrintDialog.cs
- IsolatedStorageFileStream.cs
- PeerToPeerException.cs
- SecurityImpersonationBehavior.cs
- TraceUtils.cs
- EUCJPEncoding.cs
- MapPathBasedVirtualPathProvider.cs
- StateItem.cs
- SafeCryptContextHandle.cs
- TableParaClient.cs
- SynchronizationLockException.cs
- ScriptManager.cs
- TransactionScope.cs
- CacheManager.cs
- TabControl.cs
- SelectionGlyph.cs
- Matrix3DConverter.cs
- CodeTypeParameterCollection.cs
- AddInAttribute.cs
- BrowserCapabilitiesFactory.cs
- ObjectStateManagerMetadata.cs
- BlobPersonalizationState.cs
- SqlErrorCollection.cs
- CacheChildrenQuery.cs
- HtmlInputPassword.cs
- XmlMembersMapping.cs
- XamlReaderHelper.cs
- X509Utils.cs
- ToolBarTray.cs
- SiteMapDataSource.cs
- WebPartManager.cs
- RegexTypeEditor.cs
- ComPersistableTypeElement.cs
- SqlHelper.cs
- UIElement3DAutomationPeer.cs
- InputLanguageSource.cs
- EnglishPluralizationService.cs
- SettingsProviderCollection.cs
- CompoundFileStorageReference.cs
- ToolBarTray.cs
- AliasGenerator.cs
- ManagementDateTime.cs
- StatusStrip.cs
- IteratorFilter.cs