Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DLinq / Dlinq / SqlClient / Query / ContainsRowNumberChecker.cs / 1305376 / ContainsRowNumberChecker.cs
using System; using System.Collections.Generic; using System.Text; namespace System.Data.Linq.SqlClient { internal class SqlRowNumberChecker { Visitor rowNumberVisitor; internal SqlRowNumberChecker() { this.rowNumberVisitor = new Visitor(); } internal bool HasRowNumber(SqlNode node) { this.rowNumberVisitor.Visit(node); return rowNumberVisitor.HasRowNumber; } internal bool HasRowNumber(SqlRow row) { foreach (SqlColumn column in row.Columns) { if (this.HasRowNumber(column)) { return true; } } return false; } internal SqlColumn RowNumberColumn { get { return rowNumberVisitor.HasRowNumber ? rowNumberVisitor.CurrentColumn : null; } } private class Visitor: SqlVisitor { bool hasRowNumber = false; public bool HasRowNumber { get { return hasRowNumber; } } public SqlColumn CurrentColumn { private set; get; } internal override SqlRowNumber VisitRowNumber(SqlRowNumber rowNumber) { this.hasRowNumber = true; return rowNumber; } // shortcuts internal override SqlExpression VisitScalarSubSelect(SqlSubSelect ss) { return ss; } internal override SqlExpression VisitSubSelect(SqlSubSelect ss) { return ss; } internal override SqlRow VisitRow(SqlRow row) { for (int i = 0, n = row.Columns.Count; i < n; i++) { row.Columns[i].Expression = this.VisitExpression(row.Columns[i].Expression); if (this.hasRowNumber) { this.CurrentColumn = row.Columns[i]; break; } } return row; } internal override SqlSelect VisitSelect(SqlSelect select) { this.Visit(select.Row); this.Visit(select.Where); return select; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CallSiteHelpers.cs
- DataFormat.cs
- ListenerAdapterBase.cs
- TypefaceMetricsCache.cs
- SortedList.cs
- ObsoleteAttribute.cs
- Domain.cs
- InstanceCreationEditor.cs
- RequestSecurityTokenResponseCollection.cs
- MouseActionConverter.cs
- InternalRelationshipCollection.cs
- SR.cs
- DataTableReader.cs
- GenericPrincipal.cs
- ProcessStartInfo.cs
- HostProtectionPermission.cs
- CompositeClientFormatter.cs
- configsystem.cs
- RegistryKey.cs
- DataContractJsonSerializerOperationBehavior.cs
- FtpWebRequest.cs
- UpdatePanelControlTrigger.cs
- HorizontalAlignConverter.cs
- TimeZone.cs
- BCLDebug.cs
- WebPartZoneBase.cs
- ThemeInfoAttribute.cs
- ZoneLinkButton.cs
- DelegateSerializationHolder.cs
- SqlCommand.cs
- ProviderManager.cs
- EmbeddedMailObjectsCollection.cs
- InkPresenter.cs
- Rectangle.cs
- Triangle.cs
- XmlDataSourceView.cs
- CustomDictionarySources.cs
- RoleBoolean.cs
- ProfileInfo.cs
- FunctionImportMapping.cs
- SimpleTextLine.cs
- MouseButton.cs
- DataBoundLiteralControl.cs
- InfoCardRSAPKCS1SignatureDeformatter.cs
- Stack.cs
- BindStream.cs
- QueryExpr.cs
- ConfigUtil.cs
- FileDialog.cs
- Parser.cs
- MutexSecurity.cs
- SchemaCollectionPreprocessor.cs
- __FastResourceComparer.cs
- ToolStripSettings.cs
- LambdaCompiler.Unary.cs
- TimersDescriptionAttribute.cs
- FileAuthorizationModule.cs
- RowUpdatingEventArgs.cs
- _SpnDictionary.cs
- XmlResolver.cs
- BuildProvider.cs
- GenerateTemporaryTargetAssembly.cs
- ItemsPresenter.cs
- Gdiplus.cs
- CollectionBase.cs
- DrawingContextDrawingContextWalker.cs
- CLSCompliantAttribute.cs
- AssemblyNameProxy.cs
- TdsParserSessionPool.cs
- XmlSchemaAppInfo.cs
- RefreshResponseInfo.cs
- CursorConverter.cs
- coordinatorfactory.cs
- ObjectDataSourceFilteringEventArgs.cs
- MasterPageParser.cs
- SignatureDescription.cs
- Rfc2898DeriveBytes.cs
- Control.cs
- HighlightOverlayGlyph.cs
- Number.cs
- COM2ColorConverter.cs
- SrgsElementFactory.cs
- BaseTemplateBuildProvider.cs
- RegistrySecurity.cs
- ReferencedAssembly.cs
- ToolStripDropDownItem.cs
- WindowsIPAddress.cs
- BitmapData.cs
- SoapRpcMethodAttribute.cs
- CacheMemory.cs
- HtmlTableRow.cs
- ChangeConflicts.cs
- APCustomTypeDescriptor.cs
- XmlNodeReader.cs
- OuterGlowBitmapEffect.cs
- SystemWebExtensionsSectionGroup.cs
- WebPartCancelEventArgs.cs
- XamlFrame.cs
- AddInBase.cs
- Select.cs