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
- BufferedGraphicsManager.cs
- Environment.cs
- LocalizeDesigner.cs
- SqlTopReducer.cs
- DesignerCommandAdapter.cs
- ASCIIEncoding.cs
- PathSegmentCollection.cs
- GridLength.cs
- ArrayElementGridEntry.cs
- XamlBrushSerializer.cs
- MatrixAnimationUsingKeyFrames.cs
- WebPartActionVerb.cs
- TagPrefixInfo.cs
- MetadataSet.cs
- _IPv4Address.cs
- GacUtil.cs
- QueryCursorEventArgs.cs
- IPAddress.cs
- xdrvalidator.cs
- ADConnectionHelper.cs
- Style.cs
- WebPartPersonalization.cs
- BasicHttpSecurity.cs
- SafeFileMappingHandle.cs
- Quaternion.cs
- TextAdaptor.cs
- Parallel.cs
- AlternationConverter.cs
- ITextView.cs
- PrintPreviewDialog.cs
- XmlAttributes.cs
- Size3DConverter.cs
- RectIndependentAnimationStorage.cs
- CalendarTable.cs
- CustomWebEventKey.cs
- EmptyCollection.cs
- QualifiedCellIdBoolean.cs
- Line.cs
- SessionViewState.cs
- OdbcConnectionFactory.cs
- WindowsGraphicsWrapper.cs
- SqlCommandBuilder.cs
- PageVisual.cs
- ConfigurationValues.cs
- TranslateTransform.cs
- DataControlCommands.cs
- Selection.cs
- Int64Converter.cs
- Events.cs
- RunInstallerAttribute.cs
- AdornerLayer.cs
- HyperLink.cs
- DrawingContextWalker.cs
- GetPageCompletedEventArgs.cs
- CodeNamespaceCollection.cs
- SafeBitVector32.cs
- ImmComposition.cs
- XmlSchemaObjectTable.cs
- ReadOnlyTernaryTree.cs
- HttpResponseHeader.cs
- Monitor.cs
- SQLMembershipProvider.cs
- ApplicationActivator.cs
- FontCacheUtil.cs
- CodeArgumentReferenceExpression.cs
- TransformedBitmap.cs
- CharacterShapingProperties.cs
- WindowsStartMenu.cs
- ApplicationDirectory.cs
- StructuralCache.cs
- GenericIdentity.cs
- XmlnsDictionary.cs
- SchemaElementDecl.cs
- MdiWindowListStrip.cs
- BitmapVisualManager.cs
- HostUtils.cs
- SQLDoubleStorage.cs
- CurrencyWrapper.cs
- MessageBodyMemberAttribute.cs
- DesignerCategoryAttribute.cs
- DataTableMapping.cs
- Vector3DIndependentAnimationStorage.cs
- ObjectContext.cs
- SessionStateItemCollection.cs
- CommentEmitter.cs
- DataSourceExpressionCollection.cs
- DataGridViewTopRowAccessibleObject.cs
- DataGridViewCellContextMenuStripNeededEventArgs.cs
- NetworkStream.cs
- BindingList.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- RawStylusInput.cs
- HMACSHA1.cs
- nulltextnavigator.cs
- SqlDelegatedTransaction.cs
- XPathScanner.cs
- WebGetAttribute.cs
- EntitySqlQueryCacheEntry.cs
- PropertyPathConverter.cs
- ISFClipboardData.cs