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
- Attributes.cs
- BitmapMetadataBlob.cs
- ObjectViewQueryResultData.cs
- JavaScriptSerializer.cs
- UserNamePasswordClientCredential.cs
- RetrieveVirtualItemEventArgs.cs
- EmptyWorkItem.cs
- StorageEndPropertyMapping.cs
- SimpleWorkerRequest.cs
- TrustSection.cs
- Int32.cs
- ConfigXmlAttribute.cs
- ConvertEvent.cs
- LogExtent.cs
- TextDecoration.cs
- TypeFieldSchema.cs
- CodeRegionDirective.cs
- RoutedPropertyChangedEventArgs.cs
- TextEditorContextMenu.cs
- ProcessHostConfigUtils.cs
- TypeConvertions.cs
- GlyphCache.cs
- OptionUsage.cs
- IPAddress.cs
- SourceElementsCollection.cs
- VirtualPath.cs
- FragmentQuery.cs
- ActiveXContainer.cs
- HitTestParameters.cs
- ProtocolViolationException.cs
- TouchesOverProperty.cs
- CatalogPartCollection.cs
- RawAppCommandInputReport.cs
- IInstanceTable.cs
- RectangleGeometry.cs
- XamlVector3DCollectionSerializer.cs
- BindableAttribute.cs
- HttpRuntime.cs
- NodeFunctions.cs
- EndpointDiscoveryMetadata.cs
- RegisteredArrayDeclaration.cs
- InvokeProviderWrapper.cs
- StartUpEventArgs.cs
- PrintPreviewGraphics.cs
- DataGridViewCheckBoxCell.cs
- WsdlParser.cs
- XDeferredAxisSource.cs
- UserUseLicenseDictionaryLoader.cs
- dataobject.cs
- MoveSizeWinEventHandler.cs
- DataGridViewIntLinkedList.cs
- ChtmlTextWriter.cs
- PrintingPermissionAttribute.cs
- RecognizedAudio.cs
- RijndaelManaged.cs
- followingsibling.cs
- SimpleHandlerBuildProvider.cs
- CounterNameConverter.cs
- ThreadAbortException.cs
- DetailsViewInsertEventArgs.cs
- ClientBuildManagerCallback.cs
- SpecialFolderEnumConverter.cs
- AuthStoreRoleProvider.cs
- XPathCompiler.cs
- FunctionImportMapping.cs
- ApplicationHost.cs
- hebrewshape.cs
- ListItemParagraph.cs
- CollectionBuilder.cs
- AssociationSetEnd.cs
- MetricEntry.cs
- XmlReader.cs
- TextStore.cs
- SafeHandles.cs
- SettingsPropertyValueCollection.cs
- CreatingCookieEventArgs.cs
- CompositeCollection.cs
- AuthenticodeSignatureInformation.cs
- WebServiceBindingAttribute.cs
- HttpRuntime.cs
- TraceContext.cs
- WaveHeader.cs
- DBCommandBuilder.cs
- SelectionRangeConverter.cs
- cookieexception.cs
- Style.cs
- TextTreeRootNode.cs
- Propagator.Evaluator.cs
- UnmanagedBitmapWrapper.cs
- OptimalBreakSession.cs
- Walker.cs
- BoundField.cs
- ConsumerConnectionPoint.cs
- MembershipUser.cs
- SqlAliaser.cs
- DropShadowEffect.cs
- Section.cs
- AnimationClockResource.cs
- XpsS0ValidatingLoader.cs
- QilPatternVisitor.cs