Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / 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
- ToolStripItemRenderEventArgs.cs
- ObjectDataSourceStatusEventArgs.cs
- PageCodeDomTreeGenerator.cs
- ObjectNavigationPropertyMapping.cs
- MediaElement.cs
- smtppermission.cs
- RotateTransform3D.cs
- DefaultPrintController.cs
- MarshalByValueComponent.cs
- CheckBoxList.cs
- TrackingStringDictionary.cs
- DeclarationUpdate.cs
- FileDialog.cs
- UniqueConstraint.cs
- BidPrivateBase.cs
- ApplicationFileParser.cs
- DataTableMapping.cs
- SchemaLookupTable.cs
- Rule.cs
- ResXResourceSet.cs
- ParallelDesigner.cs
- DataSourceControl.cs
- AddInIpcChannel.cs
- TextEditorDragDrop.cs
- XmlSchemaSimpleTypeList.cs
- ProcessModelSection.cs
- AlphabeticalEnumConverter.cs
- GuidConverter.cs
- ToolStripManager.cs
- NaturalLanguageHyphenator.cs
- BufferAllocator.cs
- PenLineJoinValidation.cs
- AnnotationComponentManager.cs
- CustomErrorsSectionWrapper.cs
- ProcessHostConfigUtils.cs
- ELinqQueryState.cs
- OutputCacheProfile.cs
- MonthCalendar.cs
- NativeMethods.cs
- CompilerTypeWithParams.cs
- HebrewNumber.cs
- XmlEnumAttribute.cs
- SqlRecordBuffer.cs
- BitmapVisualManager.cs
- EventLogPermissionEntry.cs
- XmlDataDocument.cs
- VirtualPath.cs
- ExpressionBindings.cs
- CheckBoxRenderer.cs
- SizeValueSerializer.cs
- DataListItem.cs
- SoapAttributes.cs
- TraceContextEventArgs.cs
- ComplexObject.cs
- JoinSymbol.cs
- PartialArray.cs
- DocumentReference.cs
- RowVisual.cs
- CriticalHandle.cs
- ReadOnlyDataSource.cs
- StyleCollection.cs
- SmtpException.cs
- DataBindingHandlerAttribute.cs
- Ops.cs
- AsyncStreamReader.cs
- MsmqIntegrationAppDomainProtocolHandler.cs
- ViewService.cs
- DrawingVisual.cs
- ScriptingProfileServiceSection.cs
- SkinBuilder.cs
- SamlEvidence.cs
- CodeIdentifiers.cs
- RectangleConverter.cs
- DataGridViewCellFormattingEventArgs.cs
- listitem.cs
- SessionParameter.cs
- XmlSerializableServices.cs
- StringConverter.cs
- DbReferenceCollection.cs
- PointAnimationClockResource.cs
- OleCmdHelper.cs
- QueryCacheKey.cs
- Helpers.cs
- X509ChainElement.cs
- InstancePersistenceCommandException.cs
- StructuralCache.cs
- SqlMethodCallConverter.cs
- XmlCharCheckingReader.cs
- FacetDescriptionElement.cs
- ProgressBarRenderer.cs
- RepeatBehaviorConverter.cs
- OracleConnectionFactory.cs
- SymbolEqualComparer.cs
- BaseTemplateCodeDomTreeGenerator.cs
- TemplateField.cs
- AutoResizedEvent.cs
- ListViewItemCollectionEditor.cs
- DependencySource.cs
- TypeGeneratedEventArgs.cs
- WindowsListViewSubItem.cs