IBX - TIBDatabaseInfo.GetVersion gives legacy Interbase information lazarus / 16-Databases ---------------------------------------------------------------------- rvk · 2022-05-06 09:56 I have a question/remark for tonyw. I currently use IBX under Delphi and I noticed that TIBDatabaseInfo.GetVersion gives back a legacy versionstring. If gives me WI-V6.3.9.27139 Firebird 2.5 while actually my Firebird server is WI-V2.5.9.27139 Firebird 2.5. That's because TIBDatabaseInfo.GetVersion uses isc_info_version which gives back the Interbase server version identification string. And because it's Firebird, Firebird will gives you a legacy/compatible string for Interbase 6.3 (for compatibility reasons). I fixed this myself in my program by calling for isc_info_firebird_version but I noticed IBX for Lazarus does the same. Question: I thought IBX was really only meant for Firebird or does it still work for Interbase ??? Remark: Anyway... It might be nice for the once who use it in Lazarus to have the real Firebird version (and not the 'cheap' legacy Interbase one ). If compatibility is a problem the TIBDatabaseInfo.GetVersion could still be for isc_info_version but there could be a TIBDatabaseInfo.GetFirebirdVersion. But who uses the GetVersion for Interbase nowadays in IBX for Lazarus which is meant for actual Firebird(?). GetVersion isn't actually giving back the correct version for Firebird now (which could be confusing for Firebird/Lazarus users). From the docs: isc_info_version - interbase server version identification string isc_info_firebird_version - firebird server version identification string Code: [Select]const   isc_info_isc_version = 12;   isc_info_firebird_version = 103;   isc_info_version = isc_info_isc_version;(which is already defined in inf_pub.inc but never used) ---------------------------------------------------------------------- tonyw · 2022-05-06 13:47 Quote from: rvk on May 06, 2022, 11:56:16 amI have a question/remark for tonyw. If compatibility is a problem the TIBDatabaseInfo.GetVersion could still be for isc_info_version but there could be a TIBDatabaseInfo.GetFirebirdVersion. But who uses the GetVersion for Interbase nowadays in IBX for Lazarus which is meant for actual Firebird(?). GetVersion isn't actually giving back the correct version for Firebird now (which could be confusing for Firebird/Lazarus users). From the docs: isc_info_version - interbase server version identification string isc_info_firebird_version - firebird server version identification string Code: [Select]const   isc_info_isc_version = 12;   isc_info_firebird_version = 103;   isc_info_version = isc_info_isc_version;(which is already defined in inf_pub.inc but never used) If you run the example dbinfo program you will see the following output (using Linux mint 20.3 and Firebird 3) Authentication Method = Srp Remote Protocol = TCPv4 Attachment SQLDialect = 3 Firebird/Linux/AMD/Intel/x64 (access method), version "LI-V3.0.5.33220 Firebird 3.0" Firebird/Linux/AMD/Intel/x64 (remote server), version "LI-V3.0.5.33220 Firebird 3.0/tcp (zeus)/P15:CZ" Firebird/Linux/AMD/Intel/x64 (remote interface), version "LI-V3.0.5.33220 Firebird 3.0/tcp (zeus)/P15:CZ" on disk structure version 12.0 Firebird Library Pathname = /lib/x86_64-linux-gnu/libfbclient.so.2 DB SQLDialect = 3 Allocation = 307 Base Level = 4 DB File Name = /usr/share/doc/firebird3.0-common/examples/employee.fdb DB Site Name = zeus DB Implementation No = 7 Database Created: 9-1-20 13:13:45 DB Implementation Class = 0 Space is Reserved ODS Minor Version = 0 ODS Major Version = 12 Page Size = 8192 Version = LI-V6.3.5.33220 Firebird 3.0 Current Memory = 19236544 Forced Writes Enabled Max Memory = 19376272 Number of Buffers = 2048 Sweep Interval = 20000 User Names: SYSDBA Fetches = 674 Marks = 8 Reads = 66 Writes = 2 Pages Free = 300 Pages Used = 7 Transaction Count = 1 The legacy version property is as you say. However note that the firebird version strings are returned as the top of the output. This is done by a call to the underlying Firebird IAttachment Interface as implemented as part of the Firebird Pascal API. The underlying code for GetVersion is Code: [Select]function TIBDatabaseInfo.GetVersion: String; var Version: byte; begin   CheckDatabase;   with Database.Attachment.GetDBInformation([isc_info_version]) do     if (Count > 0) and (Items[0].GetItemType = isc_info_version) then       Items[0].DecodeVersionString(Version,Result)   else      IBError(ibxeUnexpectedDatabaseInfoResp,[nil]); end; It's easy enough to modify to use isc_info_firebird_version. Maybe I will provide a FirebirdVersion property for the next release. ---------------------------------------------------------------------- tonyw · 2022-05-06 14:02 On checking out my response, I also needed to change the DecodeVersionString function as that included a check for the command byte. Having done that I was able to update the example app to give the output Authentication Method = Srp Remote Protocol = TCPv4 Attachment SQLDialect = 3 Firebird/Linux/AMD/Intel/x64 (access method), version "LI-V3.0.5.33220 Firebird 3.0" Firebird/Linux/AMD/Intel/x64 (remote server), version "LI-V3.0.5.33220 Firebird 3.0/tcp (zeus)/P15:CZ" Firebird/Linux/AMD/Intel/x64 (remote interface), version "LI-V3.0.5.33220 Firebird 3.0/tcp (zeus)/P15:CZ" on disk structure version 12.0 Firebird Library Pathname = /lib/x86_64-linux-gnu/libfbclient.so.2 DB SQLDialect = 3 Allocation = 307 Base Level = 4 DB File Name = /usr/share/doc/firebird3.0-common/examples/employee.fdb DB Site Name = zeus DB Implementation No = 7 Database Created: 9-1-20 13:13:45 DB Implementation Class = 0 Space is Reserved ODS Minor Version = 0 ODS Major Version = 12 Page Size = 8192 Version (legacy) = LI-V6.3.5.33220 Firebird 3.0 Firebird Version = LI-V3.0.5.33220 Firebird 3.0 Current Memory = 19236544 Forced Writes Enabled Max Memory = 19376272 Number of Buffers = 2048 Sweep Interval = 20000 User Names: SYSDBA Fetches = 674 Marks = 8 Reads = 66 Writes = 2 Pages Free = 300 Pages Used = 7 Transaction Count = 1 So now it gives you both the legacy and actual version string. Now part of the development tree. ---------------------------------------------------------------------- rvk · 2022-05-06 14:03 Quote from: tonyw on May 06, 2022, 03:47:54 pmThe legacy version property is as you say. However note that the firebird version strings are returned as the top of the output. This is done by a call to the underlying Firebird IAttachment Interface as implemented as part of the Firebird Pascal API. The underlying code for GetVersion is function TIBDatabaseInfo.GetVersion: String; [snip] It's easy enough to modify to use isc_info_firebird_version. Maybe I will provide a FirebirdVersion property for the next release. Yes, I was talking about the TIBDatabaseInfo.GetVersion. It's the one everyone would use to simple query for the Firebird version. I've seen version-strings on the internet with the "6.3" and "Firebird" where users identify their Firebird server (which of course isn't correct). I have fixed this myself in Delphi/IBX with my own GetRealFirebirdVersion but I thought I would mention it for IBX for Lazarus (which I'm not actively using at the moment). I also wasn't sure if IBX for Lazarus still targeted Interbase (in which case such a call with isc_info_firebird_version woulc fail). (Maybe it's an idea to rename the product to FBX for Lazarus if it isn't targeting Interbase anymore ) ---------------------------------------------------------------------- tonyw · 2022-05-06 14:06 Quote from: rvk on May 06, 2022, 04:03:01 pm[ also wasn't sure if IBX for Lazarus still targeted Interbase (in which case such a call with isc_info_firebird_version woulc fail). (Maybe it's an idea to rename the product to FBX for Lazarus if it isn't targeting Interbase anymore ) InterBase is not formally targeted, but I don't want to anything that would knowingly break an application that used InterBase. However, a FirebirdVersion property while keeping the legacy Version property should be OK. A change to FBX could be too confusing as anyone coming from Delphi to Lazarus that still wanted to use IBX may not realise that IBX for Lazarus comes from the same original codebase. ---------------------------------------------------------------------- rvk · 2022-05-06 14:08 Quote from: tonyw on May 06, 2022, 04:06:38 pmA change to FBX could be too confusing as anyone coming from Delphi to Lazarus that still wanted to use IBX may not realise that IBX for Lazarus comes from the same original codebase. 👍