Hi Mark,
On 2021-09-13 15:59, Maya Opperman wrote:
  Another possibility is to set coercion rules for new data type for your connection, see

https://firebirdsql.org/file/documentation/release_notes/html/en/4_0/rlsnotes40.html#rnfb4-msql-set-bind-native-to-legacy-coercion-rules

Thanks Vlad! In this example from this link:

SET BIND OF DECFLOAT TO DOUBLE PRECISION;
SELECT CAST('123.45' AS DECFLOAT(16)) FROM RDB$DATABASE; --double

Does this need to be done within every transaction that is started, or
per connection/session, or once off per database?

You have two options if you want to control this per database:

1. Use DataTypeCompatibility[1] in databases.conf (or firebird.conf for all databases). This allows you to restrict the types to those of Firebird 3.0 or 2.5 and Firebird will apply coercion rules for new types

2. Define an ON CONNECT database trigger that defines the rule(s) you want

You can also define the mapping rules through the database parameter buffer.

Mark

 [1]: https://www.firebirdsql.org/file/documentation/release_notes/html/en/4_0/rlsnotes40.html#rnfb40-config-datatypecompat


Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel

If someone has no control over a customer database, the DPB approach at connect level sound appealing. And Google points me to the Jaybird documentation :-)
https://firebirdsql.github.io/jaybird-manual/jaybird_manual.html#ref-datatypebind

Thanks for this hint. Very helpful!

Thomas



Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to