Class OracleSqlExpressionConvertVisitor
- Namespace
- LinqToDB.Internal.DataProvider.Oracle
- Assembly
- linq2db.dll
public class OracleSqlExpressionConvertVisitor : SqlExpressionConvertVisitor
- Inheritance
-
objectOracleSqlExpressionConvertVisitor
- Derived
- Inherited Members
- Extension Methods
Constructors
OracleSqlExpressionConvertVisitor(bool)
public OracleSqlExpressionConvertVisitor(bool allowModify)
Parameters
allowModifybool
Fields
OracleLikeCharactersToEscape
protected static readonly string[] OracleLikeCharactersToEscape
Field Value
- string[]
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.
CanLowerIntervalShift
Whether LowerTemporalArithmetic(SqlTemporalArithmeticExpression) can express a date shifted by an interval at all.
public override bool CanLowerIntervalShift { get; }
Property Value
Remarks
Read by the member translator so a declared duration added to a date is declined while the expression is still being built, rather than reaching the builder as a node nothing can render - a refusal there has no client-side fallback left. The default follows what the base implementation needs: it spends the amount through ShiftDate(SqlIntervalUnit, ISqlExpression, ISqlExpression) at FinestDateUnit, so a provider that names no finest unit cannot lower one.
Only the declared half is declined early. A shift by a computed difference is left to be built,
because start + (end - start) cancels against the difference it came from and asks the provider
for nothing - refusing it here would sink a query that works everywhere.
ConcatRequiresExplicitStringCast
When true (default), ConvertConcat(SqlConcatExpression) wraps every non-string
operand in an explicit CAST(... AS VARCHAR(N)) before adding it to the concat chain.
Required for providers whose concat operator is + (SQL Server pre-2025, SqlCe,
Access) — SQL-standard data-type precedence would otherwise try to coerce
string operands to the non-string side's type. Most providers whose final concat operator
is || (PostgreSQL / Oracle / SQLite / SAP HANA / DuckDB / Firebird / DB2 / Informix /
SQL Server 2025+) or CONCAT(...) function (MySQL / ClickHouse) auto-coerce
non-string operands and override this to false for cleaner SQL.
Sybase ASE is the exception: it emits || but keeps this true,
since ASE requires an explicit convert() for non-character operands under both
+ and ||.
protected override bool ConcatRequiresExplicitStringCast { get; }
Property Value
IntervalResolution
The operands are narrowed to six fractional digits before they are subtracted, so a component below the microsecond is identically zero rather than merely imprecise, and is declined instead.
public override SqlIntervalUnit IntervalResolution { get; }
Property Value
Remarks
AsTimestamp(ISqlExpression) casts to DateTime2 with no precision, which renders as a
bare timestamp - six digits - so the sub-microsecond tick cannot survive the subtraction whatever
the column holds. Declaring the floor makes the member fall back to .NET, which answers it from the two
dates, rather than depending on what the driver happens to round-trip.
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[]
Methods
ConvertCoalesce(SqlCoalesceExpression)
public override ISqlExpression ConvertCoalesce(SqlCoalesceExpression element)
Parameters
elementSqlCoalesceExpression
Returns
ConvertConcat(SqlConcatExpression)
public override ISqlExpression ConvertConcat(SqlConcatExpression element)
Parameters
elementSqlConcatExpression
Returns
ConvertConversion(SqlCastExpression)
Implements SqlCastExpression conversion.
protected override ISqlExpression ConvertConversion(SqlCastExpression cast)
Parameters
castSqlCastExpression
Returns
ConvertDefaultValue(SqlDefaultValueExpression)
Writes the default a reader substitutes for a NULL: as its value here, and as the least value of the column's type where a provider's type cannot hold it.
public override ISqlExpression ConvertDefaultValue(SqlDefaultValueExpression expression)
Parameters
expressionSqlDefaultValueExpressionThe default to write.
Returns
- ISqlExpression
The expression the default is written as.
ConvertExprExprPredicate(ExprExpr)
public override IQueryElement ConvertExprExprPredicate(SqlPredicate.ExprExpr predicate)
Parameters
predicateSqlPredicate.ExprExpr
Returns
ConvertSqlBinaryExpression(SqlBinaryExpression)
public override IQueryElement ConvertSqlBinaryExpression(SqlBinaryExpression element)
Parameters
elementSqlBinaryExpression
Returns
ConvertSqlCaseExpression(SqlCaseExpression)
protected override ISqlExpression ConvertSqlCaseExpression(SqlCaseExpression element)
Parameters
elementSqlCaseExpression
Returns
ConvertSqlCondition(SqlConditionExpression)
protected override ISqlExpression ConvertSqlCondition(SqlConditionExpression element)
Parameters
elementSqlConditionExpression
Returns
ConvertSqlExpression(SqlExpression)
public override ISqlExpression ConvertSqlExpression(SqlExpression element)
Parameters
elementSqlExpression
Returns
ConvertSqlFunction(SqlFunction)
public override ISqlExpression ConvertSqlFunction(SqlFunction func)
Parameters
funcSqlFunction
Returns
ConvertSqlUnaryExpression(SqlUnaryExpression)
public override ISqlExpression ConvertSqlUnaryExpression(SqlUnaryExpression element)
Parameters
elementSqlUnaryExpression
Returns
ElapsedTicks(SqlIntervalDifferenceExpression)
Elapsed ticks summed field by field out of the interval two timestamps subtract to.
protected override ISqlExpression? ElapsedTicks(SqlIntervalDifferenceExpression element)
Parameters
elementSqlIntervalDifferenceExpression
Returns
Remarks
Both operands are cast to timestamp first: subtracting Oracle date values yields a number
of days instead, and a date carries no fraction of a second to lose. Field by field rather than through
the day count, because that count is a floating number of days and cannot carry a tick over a long
range - the same reason the existing DateDiff lowering decomposes its millisecond form.
Fields of a negative interval are all negative, so the sum needs no sign handling.
IsWindowOrderByRequired(SqlExtendedFunction)
Every ranking function, plus LAG/LEAD, plus any frame - all of them ORA-30485: missing
ORDER BY expression in the window specification. Unlike SQL Server, Oracle is content to leave
FIRST_VALUE/LAST_VALUE unordered, and an unframed aggregate is unconstrained.
protected override bool IsWindowOrderByRequired(SqlExtendedFunction func)
Parameters
funcSqlExtendedFunction
Returns
LowerTemporalArithmetic(SqlTemporalArithmeticExpression)
Shifts by the whole days and the seconds left over, each through NUMTODSINTERVAL, added natively.
protected override ISqlExpression? LowerTemporalArithmetic(SqlTemporalArithmeticExpression element)
Parameters
elementSqlTemporalArithmeticExpression
Returns
Remarks
Split in two because NUMTODSINTERVAL refuses an amount of 231 or more of its unit, which
a second count reaches after 68 years; a day count does not reach it at all. Both parts are exact
NUMBER arithmetic on the tick count and carry its sign, so the seconds keep their fraction down to
the tick.
A DateTime is cast to timestamp(7) first, whatever its mapping declares. The result of
adding an interval to a date is a date, which has no fraction of a second to keep, and a
date column mapped as a plain DateTime is not declared as one. The cast is mandatory,
so it is not dropped as a no-op for a value already believed to be a timestamp, and seven digits keep the
tick of a value that already is one.
TruncateDivide(ISqlExpression, long)
Oracle's TRUNC already is truncation toward zero, the semantic the base composes FLOOR
and CEILING to reach - and Oracle spells the second one CEIL, so that composition does
not even parse here.
protected override ISqlExpression TruncateDivide(ISqlExpression value, long divisor)
Parameters
valueISqlExpressiondivisorlong
Returns
VisitSqlValuesTable(SqlValuesTable)
protected override IQueryElement VisitSqlValuesTable(SqlValuesTable element)
Parameters
elementSqlValuesTable