Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- FileDetails.cs
- XmlQueryTypeFactory.cs
- DictionaryBase.cs
- CurrentChangingEventArgs.cs
- ZipIOExtraField.cs
- BitmapEditor.cs
- Normalization.cs
- FlowLayoutPanel.cs
- _SingleItemRequestCache.cs
- TextEditor.cs
- PageCatalogPart.cs
- Certificate.cs
- PictureBox.cs
- OleDbConnectionInternal.cs
- ValidateNames.cs
- PopOutPanel.cs
- Filter.cs
- PermissionSetEnumerator.cs
- Query.cs
- TagNameToTypeMapper.cs
- UniformGrid.cs
- DBSchemaRow.cs
- COM2IDispatchConverter.cs
- LazyTextWriterCreator.cs
- FormViewPagerRow.cs
- ReversePositionQuery.cs
- PeerPresenceInfo.cs
- ToolStripSettings.cs
- PaintEvent.cs
- CategoryAttribute.cs
- Events.cs
- RightsManagementEncryptionTransform.cs
- JoinElimination.cs
- SystemException.cs
- ConfigurationLocationCollection.cs
- MediaElement.cs
- StateDesigner.TransitionInfo.cs
- SecurityDescriptor.cs
- RemotingException.cs
- BinaryParser.cs
- ListViewUpdateEventArgs.cs
- HandleValueEditor.cs
- AccessedThroughPropertyAttribute.cs
- LocalizationParserHooks.cs
- VBCodeProvider.cs
- Visual3D.cs
- securitymgrsite.cs
- ValueSerializerAttribute.cs
- DescendantBaseQuery.cs
- DetailsView.cs
- Viewport3DAutomationPeer.cs
- TreeNodeCollection.cs
- WhitespaceRuleLookup.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- BreakRecordTable.cs
- TransformerInfoCollection.cs
- IProvider.cs
- RegexCompiler.cs
- DataGridViewSelectedRowCollection.cs
- ServiceObjectContainer.cs
- Drawing.cs
- ToolboxBitmapAttribute.cs
- ListDesigner.cs
- SchemaTableOptionalColumn.cs
- ConfigXmlElement.cs
- Nullable.cs
- PropertySourceInfo.cs
- keycontainerpermission.cs
- CustomErrorsSection.cs
- WindowsGraphicsCacheManager.cs
- NonParentingControl.cs
- Block.cs
- UnconditionalPolicy.cs
- RoutedPropertyChangedEventArgs.cs
- XmlSchemaSearchPattern.cs
- BaseDataBoundControl.cs
- TransformDescriptor.cs
- WebPartTracker.cs
- PageEventArgs.cs
- Scheduling.cs
- SectionInformation.cs
- DiscreteKeyFrames.cs
- GridViewDeletedEventArgs.cs
- CompareInfo.cs
- LassoSelectionBehavior.cs
- GPPOINTF.cs
- VideoDrawing.cs
- sqlstateclientmanager.cs
- RuntimeHandles.cs
- AuthenticationService.cs
- Fonts.cs
- WebPartConnectionsConfigureVerb.cs
- CompositeFontParser.cs
- Point3DCollection.cs
- ExpandSegmentCollection.cs
- SqlProcedureAttribute.cs
- HiddenField.cs
- MatrixAnimationUsingPath.cs
- DataGridViewCellEventArgs.cs
- FileSystemInfo.cs