Link Search Menu Expand Document

FirebirdConvertFieldResolver


This class resolves a Field into a CAST(column AS TYPE) SQL fragment whenever the field carries an explicit .Type, using DbTypeToFirebirdStringNameResolver to determine the Firebird type name. It is used internally by FirebirdStatementBuilder and is not typically used directly.

Firebird’s AVG() returns a value of the same exact-numeric type as its argument (e.g. AVG(INTEGER) is itself INTEGER), truncating any fractional part instead of widening to a floating-point type the way MySQL/SQL Server do. BaseStatementBuilder already widens exact-numeric field types to double before this resolver runs (via ClientTypeToAverageableClientTypeResolver), so Average/AverageAll cast to DOUBLE PRECISION rather than truncating.

Usability

var resolver = new FirebirdConvertFieldResolver();
var expression = resolver.Resolve(new Field("Age", typeof(int)), dbSetting);
// CAST("Age" AS INTEGER)