views:

1067

answers:

3

Hi,

Exist any Way to Determine the Version of Firebird SQL is running? using SQL or code (delphi, C++).

Bye

A: 

Two things you can do:

  • Use the Services API to query the server version, the call is isc_service_query() with the isc_info_svc_server_version parameter. Your preferred Delphi component set should surface a method to wrap this API.
    For C++ there is for example IBPP which has IBPP::Service::GetVersion() to return the version string.
    What you get back with these is the same string that is shown in the control panel applet.

  • If you need to check whether certain features are available it may be enough (or even better) to execute statements against the system tables to check whether a given system relation or some field in that relation is available. If the ODS of the database is from an older version some features may not be supported, even though the server version is recent enough.
    The ODS version can also be queried via the API, use the isc_database_info() call.

mghie
A: 

May be you have FIBPlus ( http://www.devrace.com/en/fibplus/ ) ... it has all the tools and sources necessary to install, uninstall, start, stop Firebird/Interbase and also to get the version of the server and more. In any case, you can get the version from the client driver (fbclient.dll for Firebird). DelphiDabbler ( http://www.delphidabbler.com/software/verinfo/download ) has free sources that get file version of any DLL. You can easily use that.

volvox
The version of the client library has nothing to do with the version of the server, different versions can be mixed and matched easily. Even with a local server the client library may well have a different version.
mghie
OK - That i did not know. Looking at my actual GDS32.DLL i get: Translation = Anglais (États-Unis) - Windows 3.1 US (ANSI) / Multilingual CompanyName = Embarcadero Technologies, Inc.FileDescription = InterBase Server FileVersion = WI-V9.0.2.420InternalName = InterBase LegalCopyright = Copyright (c) 1986 - 2008 Embarcadero Technologies, Inc. ProductName = InterBase Server ProductVersion = 9.0.2.420
volvox
For Firebird FBCLIENT.DLL: FileDescription = Firebird SQL Server FileVersion = WI-V2.1.2.18118 InternalName = Firebird LegalCopyright = All Copyright (c) retained by individual contributors - original code Copyright (c) 2000 Inprise CorporationProductName = Firebird SQL Server ProductVersion = 2.1.2.18118SpecialBuild = Firebird 2.1
volvox
And this client library version makes only sense when the database is on localhost, otherwise the Firebird server could be for example 1.5.5 on Linux or some other *nix. Asking the server is the only way to be sure.
mghie
+4  A: 

If you want to find it via SQL you can use get_context to find the engine version it with the following:

SELECT rdb$get_context('SYSTEM', 'ENGINE_VERSION') 
             as version from rdb$database;

you can read more about it here firebird faq, but it requires Firebird 2.1 I believe.

Re0sless
Why did you use 2 single quotes in 'system' and 'engine_version' query fails that way, but with single quotes returns proper result
Aldo
oops sorry , I cut and paste it from a SQL string in our Delphi app :P, fixed now.
Re0sless
Thanks very much.
RRUZ
@Re0sless: Given that this will bomb for all versions before FB 2.1, isn't that cheating? Would you call a Vista-only API function and catch the possible crashes only to find out what Windows version the program runs on? The question was awfully vague, but this feels just wrong.
mghie