Class SqlIntervalDifferenceExpression
The interval elapsed between two temporal values.
public sealed class SqlIntervalDifferenceExpression : SqlExpressionBase, ISqlExpression, IQueryElement, IEquatable<ISqlExpression>
- Inheritance
-
objectSqlIntervalDifferenceExpression
- Implements
- Inherited Members
- Extension Methods
Remarks
The contract is exactly End - Start: elapsed time, signed, exact within the resolution of
IntervalType. It is deliberately not a boundary count - Sql.DateDiff counts how many
unit boundaries were crossed, which for 10:59 to 11:01 gives one hour where the elapsed duration is two
minutes. Keeping the two apart in the AST is what stops that confusion from being reintroduced downstream.
There is no unit on this node. It produces a whole interval, not "a number of hours" - a unit only becomes meaningful when a part or a total is requested, which is SqlIntervalPartExpression.
Constructors
SqlIntervalDifferenceExpression(ISqlExpression, ISqlExpression, DbDataType, SqlIntervalType)
public SqlIntervalDifferenceExpression(ISqlExpression start, ISqlExpression end, DbDataType type, SqlIntervalType intervalType)
Parameters
startISqlExpressionendISqlExpressiontypeDbDataTypeintervalTypeSqlIntervalType
Properties
ElementType
AST node type.
public override QueryElementType ElementType { get; }
Property Value
End
Minuend - the later value in a positive result.
public ISqlExpression End { get; }
Property Value
IntervalType
Logical type of the produced interval.
public SqlIntervalType IntervalType { get; }
Property Value
Precedence
public override int Precedence { get; }
Property Value
Start
Subtrahend - the earlier value in a positive result.
public ISqlExpression Start { get; }
Property Value
SystemType
public override Type? SystemType { get; }
Property Value
Type
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, SqlIntervalType)
public void Modify(ISqlExpression start, ISqlExpression end, DbDataType type, SqlIntervalType intervalType)
Parameters
startISqlExpressionendISqlExpressiontypeDbDataTypeintervalTypeSqlIntervalType
ToString(QueryElementTextWriter)
Generates debug text representation of AST node.
public override QueryElementTextWriter ToString(QueryElementTextWriter writer)
Parameters
writerQueryElementTextWriter