Table of Contents

Class OracleSqlExpressionConvertVisitor

Namespace
LinqToDB.Internal.DataProvider.Oracle
Assembly
linq2db.dll
public class OracleSqlExpressionConvertVisitor : SqlExpressionConvertVisitor
Inheritance
object
OracleSqlExpressionConvertVisitor
Derived
Inherited Members
Extension Methods

Constructors

OracleSqlExpressionConvertVisitor(bool)

public OracleSqlExpressionConvertVisitor(bool allowModify)

Parameters

allowModify bool

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

bool

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

bool

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

SqlIntervalUnit

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

element SqlCoalesceExpression

Returns

ISqlExpression

ConvertConcat(SqlConcatExpression)

public override ISqlExpression ConvertConcat(SqlConcatExpression element)

Parameters

element SqlConcatExpression

Returns

ISqlExpression

ConvertConversion(SqlCastExpression)

Implements SqlCastExpression conversion.

protected override ISqlExpression ConvertConversion(SqlCastExpression cast)

Parameters

cast SqlCastExpression

Returns

ISqlExpression

ConvertExprExprPredicate(ExprExpr)

public override IQueryElement ConvertExprExprPredicate(SqlPredicate.ExprExpr predicate)

Parameters

predicate SqlPredicate.ExprExpr

Returns

IQueryElement

ConvertSqlBinaryExpression(SqlBinaryExpression)

public override IQueryElement ConvertSqlBinaryExpression(SqlBinaryExpression element)

Parameters

element SqlBinaryExpression

Returns

IQueryElement

ConvertSqlCaseExpression(SqlCaseExpression)

protected override ISqlExpression ConvertSqlCaseExpression(SqlCaseExpression element)

Parameters

element SqlCaseExpression

Returns

ISqlExpression

ConvertSqlCondition(SqlConditionExpression)

protected override ISqlExpression ConvertSqlCondition(SqlConditionExpression element)

Parameters

element SqlConditionExpression

Returns

ISqlExpression

ConvertSqlExpression(SqlExpression)

public override ISqlExpression ConvertSqlExpression(SqlExpression element)

Parameters

element SqlExpression

Returns

ISqlExpression

ConvertSqlFunction(SqlFunction)

public override ISqlExpression ConvertSqlFunction(SqlFunction func)

Parameters

func SqlFunction

Returns

ISqlExpression

ConvertSqlUnaryExpression(SqlUnaryExpression)

public override ISqlExpression ConvertSqlUnaryExpression(SqlUnaryExpression element)

Parameters

element SqlUnaryExpression

Returns

ISqlExpression

ElapsedTicks(SqlIntervalDifferenceExpression)

Elapsed ticks summed field by field out of the interval two timestamps subtract to.

protected override ISqlExpression? ElapsedTicks(SqlIntervalDifferenceExpression element)

Parameters

element SqlIntervalDifferenceExpression

Returns

ISqlExpression

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

func SqlExtendedFunction

Returns

bool

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

value ISqlExpression
divisor long

Returns

ISqlExpression

VisitSqlValuesTable(SqlValuesTable)

protected override IQueryElement VisitSqlValuesTable(SqlValuesTable element)

Parameters

element SqlValuesTable

Returns

IQueryElement