Class SqlTemporalArithmeticExpression
A temporal value shifted by an interval. The result is temporal, not an interval.
public sealed class SqlTemporalArithmeticExpression : SqlExpressionBase, ISqlExpression, IQueryElement, IEquatable<ISqlExpression>
- Inheritance
-
objectSqlTemporalArithmeticExpression
- Implements
- Inherited Members
- Extension Methods
Remarks
Kept as its own node rather than a SqlBinaryExpression because that one carries its operation as a plain string and its type as a DbDataType, neither of which has room for interval semantics - it would render as a literal infix and any optimizer would be free to treat it as ordinary arithmetic.
Constructors
SqlTemporalArithmeticExpression(ISqlExpression, ISqlExpression, bool, DbDataType)
public SqlTemporalArithmeticExpression(ISqlExpression temporal, ISqlExpression interval, bool isSubtract, DbDataType type)
Parameters
temporalISqlExpressionintervalISqlExpressionisSubtractbooltypeDbDataType
Properties
ElementType
AST node type.
public override QueryElementType ElementType { get; }
Property Value
Interval
Interval to shift by, carrying no unit of its own.
public ISqlExpression Interval { get; }
Property Value
Remarks
Either a SqlIntervalDifferenceExpression, which each provider lowers into the form its own date arithmetic takes, or an amount already reduced to ticks. Never a SqlIntervalExpression: that one holds a number in a declared unit, and nothing downstream can recover the unit from the node it lowers to - so the translator converts it before building this one.
IsSubtract
public bool IsSubtract { get; }
Property Value
Precedence
public override int Precedence { get; }
Property Value
SystemType
public override Type? SystemType { get; }
Property Value
Temporal
Value being shifted.
public ISqlExpression Temporal { get; }
Property Value
Type
Result type - the temporal type of Temporal.
public DbDataType Type { get; }
Property Value
Methods
Accept(QueryElementVisitor)
Visitor support.
public override IQueryElement Accept(QueryElementVisitor visitor)
Parameters
visitorQueryElementVisitor
Returns
CanBeNullable(NullabilityContext)
public override bool CanBeNullable(NullabilityContext nullability)
Parameters
nullabilityNullabilityContext
Returns
Equals(ISqlExpression, Func<ISqlExpression, ISqlExpression, bool>)
public override bool Equals(ISqlExpression other, Func<ISqlExpression, ISqlExpression, bool> comparer)
Parameters
otherISqlExpressioncomparerFunc<ISqlExpression, ISqlExpression, bool>
Returns
GetElementHashCode()
public override int GetElementHashCode()
Returns
Modify(ISqlExpression, ISqlExpression, DbDataType)
public void Modify(ISqlExpression temporal, ISqlExpression interval, DbDataType type)
Parameters
temporalISqlExpressionintervalISqlExpressiontypeDbDataType
ToString(QueryElementTextWriter)
Generates debug text representation of AST node.
public override QueryElementTextWriter ToString(QueryElementTextWriter writer)
Parameters
writerQueryElementTextWriter