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
- CacheDependency.cs
- SqlConnectionFactory.cs
- FontFamily.cs
- HierarchicalDataSourceConverter.cs
- DesigntimeLicenseContext.cs
- FieldNameLookup.cs
- CodeRemoveEventStatement.cs
- RawStylusInputReport.cs
- IdentifierService.cs
- GridView.cs
- SourceItem.cs
- TabControlCancelEvent.cs
- ContextProperty.cs
- ExternalDataExchangeService.cs
- ResourceSet.cs
- CultureTable.cs
- ZipFileInfo.cs
- SHA384Cng.cs
- TypeNameConverter.cs
- NullableDoubleAverageAggregationOperator.cs
- _SslStream.cs
- SoapIncludeAttribute.cs
- QilDataSource.cs
- PresentationTraceSources.cs
- XmlNodeChangedEventManager.cs
- Application.cs
- CollectionViewProxy.cs
- RuleSet.cs
- ByteFacetDescriptionElement.cs
- SelectionList.cs
- XPathNode.cs
- NamespaceListProperty.cs
- HttpSessionStateBase.cs
- processwaithandle.cs
- InProcStateClientManager.cs
- QuaternionValueSerializer.cs
- MetabaseServerConfig.cs
- Transform3DGroup.cs
- RemoteWebConfigurationHostServer.cs
- ChangeInterceptorAttribute.cs
- BitHelper.cs
- MobileCapabilities.cs
- SiteMapNodeItemEventArgs.cs
- EndpointDiscoveryElement.cs
- URLIdentityPermission.cs
- ColorContext.cs
- QueueTransferProtocol.cs
- SerialErrors.cs
- serverconfig.cs
- ECDiffieHellman.cs
- PageCatalogPart.cs
- ToggleProviderWrapper.cs
- LicFileLicenseProvider.cs
- SpellCheck.cs
- EdmSchemaError.cs
- NamespaceEmitter.cs
- XmlSchemaComplexContent.cs
- TypeGeneratedEventArgs.cs
- SelectionGlyphBase.cs
- DurationConverter.cs
- CapabilitiesRule.cs
- PropertyMetadata.cs
- SemanticResolver.cs
- VariableQuery.cs
- Point4DValueSerializer.cs
- SocketAddress.cs
- _Rfc2616CacheValidators.cs
- SmiConnection.cs
- WebBrowserEvent.cs
- TextDecoration.cs
- StringTraceRecord.cs
- Renderer.cs
- BindingList.cs
- EventLogTraceListener.cs
- DetailsViewInsertedEventArgs.cs
- COM2EnumConverter.cs
- HtmlInputHidden.cs
- SplayTreeNode.cs
- PartitionResolver.cs
- ScriptComponentDescriptor.cs
- EdmError.cs
- _DomainName.cs
- MembershipUser.cs
- CodeGenerator.cs
- smtppermission.cs
- CompilationUtil.cs
- OdbcStatementHandle.cs
- RawStylusInputReport.cs
- EditBehavior.cs
- XmlMapping.cs
- DockProviderWrapper.cs
- ColorContext.cs
- MD5CryptoServiceProvider.cs
- Point3DCollectionConverter.cs
- DynamicPropertyHolder.cs
- HighContrastHelper.cs
- ResolvedKeyFrameEntry.cs
- Transactions.cs
- ProtocolInformationWriter.cs
- NamespaceEmitter.cs