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
- CodeDOMProvider.cs
- ValidatingReaderNodeData.cs
- ExpressionStringBuilder.cs
- CriticalHandle.cs
- HttpListenerException.cs
- TraceContext.cs
- CodeBinaryOperatorExpression.cs
- HealthMonitoringSectionHelper.cs
- ToolStripStatusLabel.cs
- ValueType.cs
- RadioButtonBaseAdapter.cs
- DeflateStream.cs
- TextEndOfLine.cs
- TitleStyle.cs
- ContentControl.cs
- ClientUriBehavior.cs
- ConfigurationCollectionAttribute.cs
- TableLayoutRowStyleCollection.cs
- TemplateControlParser.cs
- ObjRef.cs
- SettingsSavedEventArgs.cs
- TabletDevice.cs
- NonBatchDirectoryCompiler.cs
- PartitionResolver.cs
- ImageSource.cs
- DataSpaceManager.cs
- SqlColumnizer.cs
- WindowsToolbarAsMenu.cs
- DigitalSignature.cs
- DateTimeFormatInfo.cs
- Package.cs
- SelectionWordBreaker.cs
- WindowsScrollBarBits.cs
- SplitContainerDesigner.cs
- DataGridViewCellStyle.cs
- columnmapkeybuilder.cs
- ErrorWebPart.cs
- ScrollBar.cs
- XmlSchemaParticle.cs
- ModelUIElement3D.cs
- OleStrCAMarshaler.cs
- DecoderBestFitFallback.cs
- TextTreeInsertUndoUnit.cs
- SiteMapProvider.cs
- DataGridViewCellPaintingEventArgs.cs
- CustomPopupPlacement.cs
- ProxyHelper.cs
- FrugalMap.cs
- RSAOAEPKeyExchangeDeformatter.cs
- ConfigXmlSignificantWhitespace.cs
- StyleBamlTreeBuilder.cs
- XmlCDATASection.cs
- PersianCalendar.cs
- DocumentCollection.cs
- Util.cs
- CngProperty.cs
- StylusCollection.cs
- NullableIntMinMaxAggregationOperator.cs
- BinHexEncoder.cs
- URLMembershipCondition.cs
- DBConnectionString.cs
- VisualStateGroup.cs
- IRCollection.cs
- DataListDesigner.cs
- GeneralTransformGroup.cs
- DateTimeOffset.cs
- MILUtilities.cs
- DiagnosticsElement.cs
- CodeVariableDeclarationStatement.cs
- CommandPlan.cs
- HttpPostedFile.cs
- HandleExceptionArgs.cs
- ViewBase.cs
- Hyperlink.cs
- DelegateSerializationHolder.cs
- NameSpaceEvent.cs
- LazyInitializer.cs
- StreamResourceInfo.cs
- RegisteredDisposeScript.cs
- TextParagraphProperties.cs
- RecognizerInfo.cs
- ListBase.cs
- ParallelEnumerableWrapper.cs
- Speller.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- CustomTrackingRecord.cs
- DynamicDocumentPaginator.cs
- XmlQueryRuntime.cs
- IconBitmapDecoder.cs
- CryptoHandle.cs
- DataGridComboBoxColumn.cs
- ForEachAction.cs
- GridViewSelectEventArgs.cs
- CompleteWizardStep.cs
- TemplatedMailWebEventProvider.cs
- DeviceFilterDictionary.cs
- COM2FontConverter.cs
- ReferentialConstraint.cs
- TableCellCollection.cs
- DynamicResourceExtension.cs