diff --git a/builds/install/misc/firebird.conf.in b/builds/install/misc/firebird.conf.in index eba66698db..5830d25a9e 100644 --- a/builds/install/misc/firebird.conf.in +++ b/builds/install/misc/firebird.conf.in @@ -429,8 +429,8 @@ # plugin using SHA-1 for the client proof. This enables backwards compatibility # with old Firebird 3 servers but does not comply with NIST security requirements. # -# The default client configuration (AuthClient) also supports the pre-Firebird 3 legacy -# authentication protocol (Legacy_Auth). This is again for backwards +# The default client configuration (AuthClient) also supports the pre-Firebird 3 legacy +# authentication protocol (Legacy_Auth). This is again for backwards # compatibility but has many known weaknesses and is deprecated for current use. # # The default Windows client configuration (AuthClient) also includes support for @@ -657,7 +657,7 @@ # mode by default. In this mode rec_version/no_rec_version transaction flags have # no effect. Setting this parameter to 0 effectively reverts engine to legacy # behavior. -# +# # CAUTION! # There is no guarantee that legacy behavior will be available in future Firebird # versions. @@ -666,6 +666,20 @@ # #ReadConsistency = 1 +# ---------------------------- +# Engine currently provides a number of new datatypes unknown to legacy clients. +# In order to simplify use of old applications set this parameter to minor FB +# version datatype compatibility with which you need. Currently two values are +# supported: 3.0 & 2.5. +# More precise (including per-session) tuning is possible via SQL and DPB. +# +# Per-database configurable. +# +# Type: string +# +#DataTypeCompatibility = + + # ---------------------------- # Client Connection Settings (Basic) # diff --git a/doc/sql.extensions/README.set_bind.md b/doc/sql.extensions/README.set_bind.md index d682bfea62..db26ad5c98 100644 --- a/doc/sql.extensions/README.set_bind.md +++ b/doc/sql.extensions/README.set_bind.md @@ -20,23 +20,45 @@ SET BIND OF type NATIVE; Makes it possible to define rules of describing types of returned to the client columns in non-standard way - `type-from` is replaced with `type-to`, automatic data coercion takes place. -Except SQL-statement there are two more ways to specify data coercion - tag `isc_dpb_bind` in DPB -and `SetBind` parameter in firebird.conf & databases.conf. The later the rule is introduced (.conf->DPB->SQL) -the higher priotiy it has. I.e. one can override any preconfigured settings from SQL statement. - When incomplete type definition is used (i.e. `CHAR` instead `CHAR(n)`) in left part of `SET BIND` coercion will take place for all `CHAR` columns, not only default `CHAR(1)`. When incomplete type definiton is used in right side of the statement (TO part) firebird engine will define missing details about that type automatically based on source column. Special `TO` part format `LEGACY` is used when datatype, missing in previous FB version, should be represented in -a way, understandable by old client software (may be with some data losses). For example, `NUMERIC(38)` in legacy -form will be represented as `NUMERIC(18)`. +a way, understandable by old client software (may be with some data losses). The following coercions are done for +legacy datatypes: + +| Native datatype | Legacy datatype | +|---|---| +| BOOLEAN | CHAR(5) | +| DECFLOAT | DOUBLE PRECISION | +| NUMERIC(38) | NUMERIC(18) | +| TIME WITH TIME ZONE | TIME WITHOUT TIME ZONE | +| TIMESTAMP WITH TIME ZONE | TIMESTAMP WITHOUT TIME ZONE | Setting `NATIVE` means `type` will be used as if there were no previous rules for it. +Except SQL-statement there are two more ways to specify data coercion - tag `isc_dpb_bind` in DPB +and `DataTypeCompatibility` parameter in firebird.conf & databases.conf. The later the rule is introduced +(.conf->DPB->SQL) the higher priotiy it has. +I.e. one can override .conf in any other way any DPB from SQL statement. -### Samples: +Value of clumplet with `isc_dpb_bind` tag in DPB should be specified as a set of partially +formed SET BIND statements, i.e. with prefix SET BIND OF is omitted, separated by semicolons. +For example: +```c++ +dpb->insertString(&status, isc_dpb_bind, "decfloat to char; numeric(38) to char"); +``` + +`DataTypeCompatibility` is minor firebird version for which we want to provide some compatibility +regarding data types. That compatibility may be not absolute - for example SET BIND can't care about type +of particular SQL functions. The following types will be described in legacy form when `DataTypeCompatibility=3.0:` +DECFLOAT, NUMERIC(38) and TIME(STAMP) WITH TIME ZONE. When `DataTypeCompatibility=2.5` in addition to this +list BOOLEAN will be described as legacy type as well. + + +### SQL Samples: ```sql SELECT CAST('123.45' AS DECFLOAT(16)) FROM RDB$DATABASE; --native