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
- XsdDateTime.cs
- WmpBitmapEncoder.cs
- SourceElementsCollection.cs
- EditorZoneDesigner.cs
- DependencyObjectPropertyDescriptor.cs
- AttributeCollection.cs
- WeakHashtable.cs
- BreakRecordTable.cs
- ConsumerConnectionPointCollection.cs
- CatalogPartCollection.cs
- TimeStampChecker.cs
- BuildDependencySet.cs
- SiteMap.cs
- CommonXSendMessage.cs
- TrustManager.cs
- ProviderIncompatibleException.cs
- HorizontalAlignConverter.cs
- Process.cs
- TraceInternal.cs
- DigestComparer.cs
- SafeArrayTypeMismatchException.cs
- Transform.cs
- PublisherMembershipCondition.cs
- ParameterCollection.cs
- ClientFormsAuthenticationCredentials.cs
- AutomationPropertyInfo.cs
- ProvidersHelper.cs
- SoapExtensionStream.cs
- WebBrowserEvent.cs
- BamlMapTable.cs
- RootProfilePropertySettingsCollection.cs
- SHA1CryptoServiceProvider.cs
- CopyOfAction.cs
- Convert.cs
- Pointer.cs
- Transform.cs
- HtmlInputCheckBox.cs
- FormattedTextSymbols.cs
- SapiInterop.cs
- CustomError.cs
- ClientType.cs
- FixUpCollection.cs
- MultipleViewProviderWrapper.cs
- SchemaSetCompiler.cs
- Privilege.cs
- ColumnMapVisitor.cs
- MemberCollection.cs
- RequestTimeoutManager.cs
- SubMenuStyleCollection.cs
- ColorMatrix.cs
- ProxyWebPartConnectionCollection.cs
- QuaternionAnimationBase.cs
- SEHException.cs
- SqlInternalConnection.cs
- ClientUtils.cs
- GorillaCodec.cs
- BitmapSource.cs
- TreeNodeConverter.cs
- LogEntrySerialization.cs
- DashStyles.cs
- RowToFieldTransformer.cs
- ProfileSection.cs
- StatusBar.cs
- MobileCapabilities.cs
- PathSegment.cs
- XmlWriterDelegator.cs
- BroadcastEventHelper.cs
- XsdValidatingReader.cs
- InputQueue.cs
- ButtonFlatAdapter.cs
- FrameAutomationPeer.cs
- SqlMultiplexer.cs
- ConfigXmlAttribute.cs
- SerialStream.cs
- ResXResourceSet.cs
- DataGridPagerStyle.cs
- Missing.cs
- TableCell.cs
- Message.cs
- PromptBuilder.cs
- SafeEventLogReadHandle.cs
- MessageVersion.cs
- EntityViewGenerationConstants.cs
- Brush.cs
- DBSqlParser.cs
- UnmanagedMemoryStream.cs
- Point3D.cs
- BamlLocalizabilityResolver.cs
- ProtectedProviderSettings.cs
- AttachInfo.cs
- arclist.cs
- DynamicDataExtensions.cs
- XmlSchemaInfo.cs
- FormViewDeleteEventArgs.cs
- Constraint.cs
- LZCodec.cs
- PropertyDescriptorGridEntry.cs
- ExternalException.cs
- DebugView.cs
- CmsInterop.cs