Class SqlCeSqlExpressionConvertVisitor
- Namespace
- LinqToDB.Internal.DataProvider.SqlCe
- Assembly
- linq2db.dll
public class SqlCeSqlExpressionConvertVisitor : SqlExpressionConvertVisitor
- Inheritance
-
objectSqlCeSqlExpressionConvertVisitor
- Inherited Members
- Extension Methods
Constructors
SqlCeSqlExpressionConvertVisitor(bool)
public SqlCeSqlExpressionConvertVisitor(bool allowModify)
Parameters
allowModifybool
Properties
CanLowerIntervalDifference
Whether an elapsed date difference can be lowered to a value here.
public override bool CanLowerIntervalDifference { get; }
Property Value
Remarks
Declared beside the lowering it describes, and read by the member translator through
ITranslationContext.ProviderFlags. The translator has to ask before it builds anything, because
a difference it does not build stays an ordinary .NET subtraction and is computed on materialisation -
and by the time this visitor runs, the read expression is already bound to its columns, so there is no
going back.
FinestDateUnit
DATEDIFF counts milliseconds, which is what a SQL CE datetime stores, so the leftover of a
total is exact.
protected override SqlIntervalUnit? FinestDateUnit { get; }
Property Value
IntervalResolution
The measurement stops at the millisecond as well, so a component asked for below one is identically zero rather than merely imprecise - the count it is taken from was rounded to a coarser unit first.
public override SqlIntervalUnit IntervalResolution { get; }
Property Value
Remarks
Declared for the reason SQLite declares the same limit: declining while the expression is still being
built leaves the member to .NET, which holds both dates and answers exactly. A stored difference does
carry a sub-millisecond part here - a datetime counts in three-and-a-third millisecond steps - so
answering zero would be a wrong number rather than a coarse one.
LikeCharactersToEscape
Characters with special meaning in LIKE predicate (defined by LikeCharactersToEscape) that should be escaped to be used as matched character.
Default: ["%", "_", "?", "*", "#", "[", "]"].
public override string[] LikeCharactersToEscape { get; }
Property Value
- string[]
SupportsNullIf
protected override bool SupportsNullIf { get; }
Property Value
Methods
ConvertConversion(SqlCastExpression)
Implements SqlCastExpression conversion.
protected override ISqlExpression ConvertConversion(SqlCastExpression cast)
Parameters
castSqlCastExpression
Returns
ConvertSearchStringPredicate(SearchString)
public override ISqlPredicate ConvertSearchStringPredicate(SqlPredicate.SearchString predicate)
Parameters
predicateSqlPredicate.SearchString
Returns
ConvertSqlBinaryExpression(SqlBinaryExpression)
public override IQueryElement ConvertSqlBinaryExpression(SqlBinaryExpression element)
Parameters
elementSqlBinaryExpression
Returns
ConvertSqlFunction(SqlFunction)
public override ISqlExpression ConvertSqlFunction(SqlFunction func)
Parameters
funcSqlFunction
Returns
CountDateBoundaries(SqlIntervalUnit, ISqlExpression, ISqlExpression)
Boundary counting through DATEDIFF, which the anchor correction turns into elapsed units.
protected override ISqlExpression? CountDateBoundaries(SqlIntervalUnit unit, ISqlExpression start, ISqlExpression end)
Parameters
unitSqlIntervalUnitstartISqlExpressionendISqlExpression
Returns
Remarks
SQL CE has no wide form of DATEDIFF, so the count is a 32-bit integer and overflows about 24 days
apart in milliseconds. Counting whole units keeps the number small for every unit a member asks for, and
the fine count that fills in a fraction is only ever taken across a window shorter than one of those
units. Only a total asked for in milliseconds spans the whole range in the fine unit, and there SQL CE
raises an overflow rather than returning a wrapped value.
ShiftDate(SqlIntervalUnit, ISqlExpression, ISqlExpression)
Shifts a date/time value by a whole number of units - the provider's DATEADD.
protected override ISqlExpression? ShiftDate(SqlIntervalUnit unit, ISqlExpression amount, ISqlExpression date)
Parameters
unitSqlIntervalUnitamountISqlExpressiondateISqlExpression
Returns
Remarks
Must be exact: the anchor correction in IntervalLowering shifts by a computed count and compares the result against the original, so an approximate shift would produce an off-by-one count.
TruncateDivide(ISqlExpression, long)
The divisor carries an explicit BIGINT cast.
protected override ISqlExpression TruncateDivide(ISqlExpression value, long divisor)
Parameters
valueISqlExpressiondivisorlong
Returns
Remarks
SQL CE types a literal past the INT range as NUMERIC, which would make the division
numeric as well - and its % rejects that type outright: "Modulo is not supported on real, float,
money, and numeric data types". Naming the type keeps the division integral.
TruncateRemainder(ISqlExpression, long)
The same explicit BIGINT the division needs - SQL CE refuses a remainder on a numeric outright.
protected override ISqlExpression TruncateRemainder(ISqlExpression value, long divisor)
Parameters
valueISqlExpressiondivisorlong