Class FirebirdSqlExpressionConvertVisitor
- Namespace
- LinqToDB.Internal.DataProvider.Firebird
- Assembly
- linq2db.dll
public class FirebirdSqlExpressionConvertVisitor : SqlExpressionConvertVisitor
- Inheritance
-
objectFirebirdSqlExpressionConvertVisitor
- Derived
- Inherited Members
- Extension Methods
Constructors
FirebirdSqlExpressionConvertVisitor(bool)
public FirebirdSqlExpressionConvertVisitor(bool allowModify)
Parameters
allowModifybool
Fields
LikeFirebirdEscapeSymbols
protected static string[] LikeFirebirdEscapeSymbols
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
2.5 truncates the count to a whole millisecond, so a component asked for below one is identically zero rather than merely imprecise, and is declined here instead. Overridden back to Tick on Firebird3SqlExpressionConvertVisitor, which is what the provider builds from version 3 up.
public override SqlIntervalUnit IntervalResolution { get; }
Property Value
Remarks
Measured rather than taken from the release notes: against engine 2.5.9 and 3.0.10, a gap of 0.4 ms
answers 0 and 0.4 respectively, and 1.5 ms answers 1 and 1.5. The hundred
microseconds a TIMESTAMP stores has been so since 2.5 - what arrived later is the fractional
DATEDIFF, and it arrived in 3.
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[]
LikeValueParameterSupport
public override bool LikeValueParameterSupport { 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
ConvertSqlUnaryExpression(SqlUnaryExpression)
public override ISqlExpression ConvertSqlUnaryExpression(SqlUnaryExpression element)
Parameters
elementSqlUnaryExpression
Returns
ElapsedTicks(SqlIntervalDifferenceExpression)
Elapsed ticks from DATEDIFF at millisecond resolution, which Firebird answers with one decimal
place.
protected override ISqlExpression? ElapsedTicks(SqlIntervalDifferenceExpression element)
Parameters
elementSqlIntervalDifferenceExpression
Returns
Remarks
That tenth of a millisecond is exactly what a Firebird timestamp stores - its resolution is a hundred microseconds - so scaling the count to ticks loses nothing, and the scaled value is always whole.
Every version comes through here, including 2.5 - this class is what FirebirdSqlOptimizer builds,
and the later ones derive from it - so the count is taken at whatever fidelity the version offers rather
than being asked for by version. From 3 on the answer carries that tenth and is exact against what the
timestamp stores. On 2.5 it is truncated to a whole millisecond, which is what
IntervalResolution below declares.
GetCaseSensitiveParameter(SearchString)
protected virtual bool? GetCaseSensitiveParameter(SqlPredicate.SearchString predicate)
Parameters
predicateSqlPredicate.SearchString
Returns
- bool?
VisitExprPredicate(Expr)
protected override IQueryElement VisitExprPredicate(SqlPredicate.Expr predicate)
Parameters
predicateSqlPredicate.Expr
Returns
WrapColumnExpression(ISqlExpression)
protected override ISqlExpression WrapColumnExpression(ISqlExpression expr)
Parameters
exprISqlExpression