Table of Contents

Class SqlTemporalArithmeticExpression

Namespace
LinqToDB.Internal.SqlQuery
Assembly
linq2db.dll

A temporal value shifted by an interval. The result is temporal, not an interval.

public sealed class SqlTemporalArithmeticExpression : SqlExpressionBase, ISqlExpression, IQueryElement, IEquatable<ISqlExpression>
Inheritance
object
SqlTemporalArithmeticExpression
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

temporal ISqlExpression
interval ISqlExpression
isSubtract bool
type DbDataType

Properties

ElementType

AST node type.

public override QueryElementType ElementType { get; }

Property Value

QueryElementType

Interval

Interval to shift by, carrying no unit of its own.

public ISqlExpression Interval { get; }

Property Value

ISqlExpression

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

true to subtract the interval, false to add it.

public bool IsSubtract { get; }

Property Value

bool

Precedence

public override int Precedence { get; }

Property Value

int

SystemType

public override Type? SystemType { get; }

Property Value

Type

Temporal

Value being shifted.

public ISqlExpression Temporal { get; }

Property Value

ISqlExpression

Type

Result type - the temporal type of Temporal.

public DbDataType Type { get; }

Property Value

DbDataType

Methods

Accept(QueryElementVisitor)

Visitor support.

public override IQueryElement Accept(QueryElementVisitor visitor)

Parameters

visitor QueryElementVisitor

Returns

IQueryElement

CanBeNullable(NullabilityContext)

public override bool CanBeNullable(NullabilityContext nullability)

Parameters

nullability NullabilityContext

Returns

bool

Equals(ISqlExpression, Func<ISqlExpression, ISqlExpression, bool>)

public override bool Equals(ISqlExpression other, Func<ISqlExpression, ISqlExpression, bool> comparer)

Parameters

other ISqlExpression
comparer Func<ISqlExpression, ISqlExpression, bool>

Returns

bool

GetElementHashCode()

public override int GetElementHashCode()

Returns

int

Modify(ISqlExpression, ISqlExpression, DbDataType)

public void Modify(ISqlExpression temporal, ISqlExpression interval, DbDataType type)

Parameters

temporal ISqlExpression
interval ISqlExpression
type DbDataType

ToString(QueryElementTextWriter)

Generates debug text representation of AST node.

public override QueryElementTextWriter ToString(QueryElementTextWriter writer)

Parameters

writer QueryElementTextWriter

Returns

QueryElementTextWriter