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.
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
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
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