Determining the Firebird version with SQL (version <2.1)
I have an application that handles databases in various locations and I want to create a check that these databases are opened using Firebird 2.5 or newer. We recently migrated from Firebird 2.0 to 2.5 and we have many databases that answer
select rdb$get_context('SYSTEM','ENGINE_VERSION') as "version" from RDB$DATABASE
with SQL error code = -804 Function unknown RDB $ GET_CONTEXT. I think because they were built with Firebird 2.0 - restoring to 2.5 has been fixed.
Is there a way to determine which firebird service is in use that can be applied to databases older than 2.1?
source share
Can your client or connection API tell you? For example isqlSHOW VERSION
or DBD :: Firebird ib_database_info
If not, just think about it hard, researching functionality from the most recent to the most ancient. Note that support for ENGINE_VERSION was introduced in version 2.1 , so there isn't much to check:
SELECT rdb$get_context('SYSTEM','ENGINE_VERSION')... -- ENGINE_VERSION >= 2.1 SELECT * FROM (SELECT ...) fb20; -- derived table -> FB 2.0 SELECT "fb15" FROM rdb$database WITH LOCK; -- LOCK -> FB 1.5 SELECT FIRST ... -- FIRST -> FB 1.0 else abort() -- prehistoric?
source share