Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / ndp / fx / src / DLinq / Dlinq / SqlClient / Query / ContainsRowNumberChecker.cs / 1 / 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.
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
- RequestQueue.cs
- AttributeUsageAttribute.cs
- WrappedReader.cs
- SizeConverter.cs
- designeractionlistschangedeventargs.cs
- RestHandler.cs
- RtfFormatStack.cs
- CachedTypeface.cs
- SerializationHelper.cs
- PanelContainerDesigner.cs
- SwitchElementsCollection.cs
- PrincipalPermissionMode.cs
- controlskin.cs
- DesignerAttribute.cs
- VectorKeyFrameCollection.cs
- UserControlAutomationPeer.cs
- SpellCheck.cs
- XamlStyleSerializer.cs
- LocalizedNameDescriptionPair.cs
- GreenMethods.cs
- MetricEntry.cs
- AsyncDataRequest.cs
- Method.cs
- DateTimeFormat.cs
- XmlSchemaType.cs
- ColorConvertedBitmap.cs
- BooleanStorage.cs
- HelloOperationAsyncResult.cs
- ResourceContainerWrapper.cs
- PageCatalogPart.cs
- QilReference.cs
- XmlDocumentSerializer.cs
- EdgeProfileValidation.cs
- Column.cs
- MetadataWorkspace.cs
- _OSSOCK.cs
- ProjectionCamera.cs
- PageContentAsyncResult.cs
- MetadataPropertyCollection.cs
- UDPClient.cs
- PropertyEntry.cs
- FocusManager.cs
- AmbientValueAttribute.cs
- NamespaceList.cs
- ExceptionHandler.cs
- EventLogPermissionAttribute.cs
- SqlBinder.cs
- RestHandlerFactory.cs
- ListControl.cs
- ObjectStateFormatter.cs
- IsolatedStorageFileStream.cs
- PenLineJoinValidation.cs
- SoapSchemaExporter.cs
- Byte.cs
- UnsafeNativeMethods.cs
- NavigationWindow.cs
- AddInAttribute.cs
- SmtpMail.cs
- Pts.cs
- coordinator.cs
- StringToken.cs
- ErrorCodes.cs
- PermissionSetTriple.cs
- cache.cs
- TableDetailsCollection.cs
- EntityDataSourceWrapperCollection.cs
- RootNamespaceAttribute.cs
- ProviderManager.cs
- MultiView.cs
- ArraySortHelper.cs
- XmlSchemaImport.cs
- FlowDocumentReader.cs
- GridViewEditEventArgs.cs
- FlowDocumentScrollViewer.cs
- HyperLinkColumn.cs
- PersonalizationEntry.cs
- storepermissionattribute.cs
- EmissiveMaterial.cs
- ADConnectionHelper.cs
- AnalyzedTree.cs
- Exceptions.cs
- Section.cs
- FontDriver.cs
- TextStore.cs
- GraphicsState.cs
- Crypto.cs
- PathGeometry.cs
- NullRuntimeConfig.cs
- ValidationSummary.cs
- ElementNotAvailableException.cs
- NavigationWindowAutomationPeer.cs
- CopyAttributesAction.cs
- WebSysDefaultValueAttribute.cs
- Mapping.cs
- XmlQueryCardinality.cs
- PrintDialogException.cs
- ObjectKeyFrameCollection.cs
- FragmentQueryKB.cs
- DebugTrace.cs
- InternalSafeNativeMethods.cs