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
- _SecureChannel.cs
- SqlConnectionStringBuilder.cs
- SecurityElement.cs
- VectorConverter.cs
- PathParser.cs
- MethodToken.cs
- DbSourceCommand.cs
- WebPartTransformerCollection.cs
- AlphaSortedEnumConverter.cs
- ServerIdentity.cs
- UnsafeNativeMethods.cs
- ValueSerializerAttribute.cs
- BamlStream.cs
- EventManager.cs
- HtmlTernaryTree.cs
- CodeCommentStatementCollection.cs
- ProfilePropertySettingsCollection.cs
- ListViewSelectEventArgs.cs
- TextOnlyOutput.cs
- __Filters.cs
- RIPEMD160Managed.cs
- sqlstateclientmanager.cs
- ProfileBuildProvider.cs
- BaseCodePageEncoding.cs
- RowVisual.cs
- TextEditor.cs
- IERequestCache.cs
- RangeBaseAutomationPeer.cs
- GlobalizationSection.cs
- DefinitionUpdate.cs
- HMACRIPEMD160.cs
- CreateUserWizardDesigner.cs
- ToolStripPanelRenderEventArgs.cs
- SeparatorAutomationPeer.cs
- ComponentResourceKeyConverter.cs
- ClientBuildManagerCallback.cs
- CodeValidator.cs
- Choices.cs
- ObjectDataSourceDisposingEventArgs.cs
- AttachedPropertyMethodSelector.cs
- FileIOPermission.cs
- _DomainName.cs
- NotifyIcon.cs
- HttpCookiesSection.cs
- CompiledWorkflowDefinitionContext.cs
- WebPartConnection.cs
- HttpCapabilitiesEvaluator.cs
- GridViewUpdateEventArgs.cs
- OleTxTransaction.cs
- NamespaceCollection.cs
- IdnElement.cs
- PropertyGroupDescription.cs
- BitConverter.cs
- SoundPlayerAction.cs
- BindingContext.cs
- TextStore.cs
- TypefaceMap.cs
- MediaPlayerState.cs
- ExpressionConverter.cs
- DiscriminatorMap.cs
- RandomNumberGenerator.cs
- HideDisabledControlAdapter.cs
- EventLogTraceListener.cs
- SizeValueSerializer.cs
- Logging.cs
- DataRecordObjectView.cs
- HttpCachePolicy.cs
- RectAnimationBase.cs
- FaultConverter.cs
- DeferredElementTreeState.cs
- SystemKeyConverter.cs
- BinaryConverter.cs
- XmlWrappingReader.cs
- XmlSchemaAppInfo.cs
- AmbientProperties.cs
- listitem.cs
- AdornerLayer.cs
- TaskFileService.cs
- MasterPageCodeDomTreeGenerator.cs
- DelegateSerializationHolder.cs
- CompositeActivityMarkupSerializer.cs
- BoolExpressionVisitors.cs
- _SslStream.cs
- ProjectionPruner.cs
- printdlgexmarshaler.cs
- TraceContextRecord.cs
- XmlNodeChangedEventManager.cs
- DataPointer.cs
- TimeoutException.cs
- ReaderWriterLock.cs
- ResourceDefaultValueAttribute.cs
- TreeNodeSelectionProcessor.cs
- MobileUserControl.cs
- WebEventTraceProvider.cs
- WebBrowserHelper.cs
- Keywords.cs
- CollectionBuilder.cs
- VisualProxy.cs
- ReleaseInstanceMode.cs
- LinqDataSourceContextEventArgs.cs