Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Data / System / Data / Filter / ExpressionNode.cs / 1 / ExpressionNode.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
// [....]
// [....]
//-----------------------------------------------------------------------------
namespace System.Data {
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data.SqlTypes;
internal abstract class ExpressionNode {
private DataTable _table;
protected ExpressionNode(DataTable table) {
_table = table;
}
internal IFormatProvider FormatProvider {
get {
return ((null != _table) ? _table.FormatProvider : System.Globalization.CultureInfo.CurrentCulture);
}
}
internal virtual bool IsSqlColumn{
get{
return false;
}
}
protected DataTable table {
get { return _table; }
}
protected void BindTable(DataTable table) {
// when the expression is created, DataColumn may not be associated with a table yet
_table = table;
}
internal abstract void Bind(DataTable table, List list);
internal abstract object Eval();
internal abstract object Eval(DataRow row, DataRowVersion version);
internal abstract object Eval(int[] recordNos);
internal abstract bool IsConstant();
internal abstract bool IsTableConstant();
internal abstract bool HasLocalAggregate();
internal abstract bool HasRemoteAggregate();
internal abstract ExpressionNode Optimize();
internal virtual bool DependsOn(DataColumn column) {
return false;
}
internal static bool IsInteger(StorageType type) {
return(type == StorageType.Int16 ||
type == StorageType.Int32 ||
type == StorageType.Int64 ||
type == StorageType.UInt16 ||
type == StorageType.UInt32 ||
type == StorageType.UInt64 ||
type == StorageType.SByte ||
type == StorageType.Byte);
}
internal static bool IsIntegerSql(StorageType type) {
return(type == StorageType.Int16 ||
type == StorageType.Int32 ||
type == StorageType.Int64 ||
type == StorageType.UInt16 ||
type == StorageType.UInt32 ||
type == StorageType.UInt64 ||
type == StorageType.SByte ||
type == StorageType.Byte ||
type == StorageType.SqlInt64 ||
type == StorageType.SqlInt32 ||
type == StorageType.SqlInt16 ||
type == StorageType.SqlByte);
}
internal static bool IsSigned(StorageType type) {
return(type == StorageType.Int16 ||
type == StorageType.Int32 ||
type == StorageType.Int64 ||
type == StorageType.SByte ||
IsFloat(type));
}
internal static bool IsSignedSql(StorageType type) {
return(type == StorageType.Int16 || // IsSigned(type)
type == StorageType.Int32 ||
type == StorageType.Int64 ||
type == StorageType.SByte ||
type == StorageType.SqlInt64 ||
type == StorageType.SqlInt32 ||
type == StorageType.SqlInt16 ||
IsFloatSql(type));
}
internal static bool IsUnsigned(StorageType type) {
return(type == StorageType.UInt16 ||
type == StorageType.UInt32 ||
type == StorageType.UInt64 ||
type == StorageType.Byte);
}
internal static bool IsUnsignedSql(StorageType type) {
return(type == StorageType.UInt16 ||
type == StorageType.UInt32 ||
type == StorageType.UInt64 ||
type == StorageType.SqlByte ||// SqlByte represents an 8-bit unsigned integer, in the range of 0 through 255,
type == StorageType.Byte);
}
internal static bool IsNumeric(StorageType type) {
return(IsFloat(type) ||
IsInteger(type));
}
internal static bool IsNumericSql(StorageType type) {
return(IsFloatSql(type) ||
IsIntegerSql(type));
}
internal static bool IsFloat(StorageType type) {
return(type == StorageType.Single ||
type == StorageType.Double ||
type == StorageType.Decimal);
}
internal static bool IsFloatSql(StorageType type) {
return(type == StorageType.Single ||
type == StorageType.Double ||
type == StorageType.Decimal ||
type == StorageType.SqlDouble ||
type == StorageType.SqlDecimal || // I expect decimal to be Integer!
type == StorageType.SqlMoney || // if decimal is here, this should be definitely here!
type == StorageType.SqlSingle);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
// [....]
// [....]
//-----------------------------------------------------------------------------
namespace System.Data {
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data.SqlTypes;
internal abstract class ExpressionNode {
private DataTable _table;
protected ExpressionNode(DataTable table) {
_table = table;
}
internal IFormatProvider FormatProvider {
get {
return ((null != _table) ? _table.FormatProvider : System.Globalization.CultureInfo.CurrentCulture);
}
}
internal virtual bool IsSqlColumn{
get{
return false;
}
}
protected DataTable table {
get { return _table; }
}
protected void BindTable(DataTable table) {
// when the expression is created, DataColumn may not be associated with a table yet
_table = table;
}
internal abstract void Bind(DataTable table, List list);
internal abstract object Eval();
internal abstract object Eval(DataRow row, DataRowVersion version);
internal abstract object Eval(int[] recordNos);
internal abstract bool IsConstant();
internal abstract bool IsTableConstant();
internal abstract bool HasLocalAggregate();
internal abstract bool HasRemoteAggregate();
internal abstract ExpressionNode Optimize();
internal virtual bool DependsOn(DataColumn column) {
return false;
}
internal static bool IsInteger(StorageType type) {
return(type == StorageType.Int16 ||
type == StorageType.Int32 ||
type == StorageType.Int64 ||
type == StorageType.UInt16 ||
type == StorageType.UInt32 ||
type == StorageType.UInt64 ||
type == StorageType.SByte ||
type == StorageType.Byte);
}
internal static bool IsIntegerSql(StorageType type) {
return(type == StorageType.Int16 ||
type == StorageType.Int32 ||
type == StorageType.Int64 ||
type == StorageType.UInt16 ||
type == StorageType.UInt32 ||
type == StorageType.UInt64 ||
type == StorageType.SByte ||
type == StorageType.Byte ||
type == StorageType.SqlInt64 ||
type == StorageType.SqlInt32 ||
type == StorageType.SqlInt16 ||
type == StorageType.SqlByte);
}
internal static bool IsSigned(StorageType type) {
return(type == StorageType.Int16 ||
type == StorageType.Int32 ||
type == StorageType.Int64 ||
type == StorageType.SByte ||
IsFloat(type));
}
internal static bool IsSignedSql(StorageType type) {
return(type == StorageType.Int16 || // IsSigned(type)
type == StorageType.Int32 ||
type == StorageType.Int64 ||
type == StorageType.SByte ||
type == StorageType.SqlInt64 ||
type == StorageType.SqlInt32 ||
type == StorageType.SqlInt16 ||
IsFloatSql(type));
}
internal static bool IsUnsigned(StorageType type) {
return(type == StorageType.UInt16 ||
type == StorageType.UInt32 ||
type == StorageType.UInt64 ||
type == StorageType.Byte);
}
internal static bool IsUnsignedSql(StorageType type) {
return(type == StorageType.UInt16 ||
type == StorageType.UInt32 ||
type == StorageType.UInt64 ||
type == StorageType.SqlByte ||// SqlByte represents an 8-bit unsigned integer, in the range of 0 through 255,
type == StorageType.Byte);
}
internal static bool IsNumeric(StorageType type) {
return(IsFloat(type) ||
IsInteger(type));
}
internal static bool IsNumericSql(StorageType type) {
return(IsFloatSql(type) ||
IsIntegerSql(type));
}
internal static bool IsFloat(StorageType type) {
return(type == StorageType.Single ||
type == StorageType.Double ||
type == StorageType.Decimal);
}
internal static bool IsFloatSql(StorageType type) {
return(type == StorageType.Single ||
type == StorageType.Double ||
type == StorageType.Decimal ||
type == StorageType.SqlDouble ||
type == StorageType.SqlDecimal || // I expect decimal to be Integer!
type == StorageType.SqlMoney || // if decimal is here, this should be definitely here!
type == StorageType.SqlSingle);
}
}
}
// 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
- TableAdapterManagerGenerator.cs
- StateItem.cs
- UnhandledExceptionEventArgs.cs
- ParameterBinding.cs
- TrackingProfileSerializer.cs
- SafeCertificateStore.cs
- OleDbCommand.cs
- WindowsGraphics2.cs
- PartialTrustHelpers.cs
- DesignerRegion.cs
- TimerEventSubscription.cs
- ColumnResizeAdorner.cs
- HttpRequestCacheValidator.cs
- AuthenticationModuleElementCollection.cs
- WebPartConnection.cs
- _HeaderInfoTable.cs
- PartEditor.cs
- Int16AnimationUsingKeyFrames.cs
- METAHEADER.cs
- ComPlusContractBehavior.cs
- SourceLineInfo.cs
- HuffModule.cs
- InstanceNotFoundException.cs
- StrongNameUtility.cs
- OdbcConnectionOpen.cs
- IList.cs
- InitializerFacet.cs
- Rfc2898DeriveBytes.cs
- DbExpressionVisitor.cs
- XmlDocumentFragment.cs
- EmissiveMaterial.cs
- ConfigurationProperty.cs
- WebBrowserHelper.cs
- WebPartCatalogAddVerb.cs
- CssClassPropertyAttribute.cs
- FloatSumAggregationOperator.cs
- SmiContextFactory.cs
- ListBindableAttribute.cs
- EmptyEnumerator.cs
- RequestTimeoutManager.cs
- DataGridLinkButton.cs
- MsmqDecodeHelper.cs
- InstanceData.cs
- SqlServer2KCompatibilityCheck.cs
- OdbcException.cs
- HWStack.cs
- GraphicsContainer.cs
- X509SecurityToken.cs
- TreeNodeConverter.cs
- HttpConfigurationContext.cs
- OdbcConnectionFactory.cs
- HtmlEmptyTagControlBuilder.cs
- SubMenuStyle.cs
- LabelLiteral.cs
- HostingEnvironmentException.cs
- CombinedHttpChannel.cs
- CharacterBufferReference.cs
- MemberInitExpression.cs
- RegexCaptureCollection.cs
- WebPartConnectionsDisconnectVerb.cs
- VBCodeProvider.cs
- MsmqInputChannelListenerBase.cs
- PriorityQueue.cs
- RichTextBox.cs
- UnauthorizedWebPart.cs
- PersonalizationDictionary.cs
- ValueTypeFixupInfo.cs
- SmtpFailedRecipientsException.cs
- SqlClientFactory.cs
- Switch.cs
- EnumerationRangeValidationUtil.cs
- Header.cs
- XmlSchemaSimpleContent.cs
- DataColumnCollection.cs
- BidOverLoads.cs
- DataGridViewControlCollection.cs
- ThemeConfigurationDialog.cs
- AssemblyAttributes.cs
- BindingMemberInfo.cs
- MULTI_QI.cs
- PagerStyle.cs
- UpdateCompiler.cs
- Int64Storage.cs
- CachedBitmap.cs
- CodeExpressionRuleDeclaration.cs
- ClientEndpointLoader.cs
- StringInfo.cs
- ResourceWriter.cs
- UIElement.cs
- DataViewListener.cs
- DropDownButton.cs
- EntityClientCacheKey.cs
- DeviceSpecific.cs
- InkCollectionBehavior.cs
- SamlAuthorityBinding.cs
- Filter.cs
- EntityDataSourceWizardForm.cs
- AssemblyAttributes.cs
- ClientUrlResolverWrapper.cs
- Image.cs