Recent

Author Topic: IBX 2.3.3 is now available for download  (Read 3199 times)

tonyw

  • Sr. Member
  • ****
  • Posts: 321
    • MWA Software
IBX 2.3.3 is now available for download
« on: February 05, 2019, 11:43:04 am »
MWA Software is pleased to announce that release 2.3.3 of IBX for Lazarus is now available for download from https://mwasoftware.co.uk/ibx. This release continues to track Lazarus 2.0 updates. Recent updates to the LCL TDBLookupComboBox have necessitated further changes to TIBLookupComboEditBox in order to ensure that TIBLookupComboEditBox continues to work when the DataSource is nil (i.e. with only a ListSource).

Otherwise, 2.3.3 consoliates further updates added to the IBX svn trunk since 2.3.2 including:

- ConfigOverrides for both TIBDatabase and TIBXServicesConnection
- Improvements to TIBCSVDataOut, TIBInsertStmtsOut and TIBBlockFormatOut.
- Case Sensitive Parameter Name support
- TIBDatabase.Attachment and TIBXServicesConnection.ServicesIntf are now read/write properties
- TIBQuery and TIBDataSet now support the TDataset.Filter property for server side filtering
  of SQL result sets.
- Minor bug fixes (see release notes for details).

The latest release candidate for Lazarus 2.0 is recommended for use with IBX 2.3.3. IBX 2.3.3
has been tested with the up-to-date fixed branch for Lazarus 2.0.

zoltanleo

  • Sr. Member
  • ****
  • Posts: 488
Re: IBX 2.3.3 is now available for download
« Reply #1 on: April 16, 2020, 03:19:42 pm »
Hi Tony.

ibx r288, laz trunk, fpc trunk.

When I try to compile dclibx.lpk, then I get compile error:
Code: Pascal  [Select][+][-]
  1. Compile package dclibx 2.3.4.9999: Exit code 1, Errors: 2, Warnings: 1, Hints: 17
  2. <skiped>
  3. ibgeneratoreditor.pas(87,35) Error: Operator is not overloaded: "Class Of TIBQuery" and "Boolean"
  4. ibgeneratoreditor.pas(88,36) Error: Operator is not overloaded: "Class Of TIBDataSet" and "Boolean"

Correcting the code this way
Code: Pascal  [Select][+][-]
  1.  if not (AGenerator.Owner is TIBTable) and
  2.    (((AGenerator.Owner is TIBQuery) and ((AGenerator.Owner as TIBQuery).SQL.Text = '')) or
  3.    ((AGenerator.Owner is TIBDataSet) and ((AGenerator.Owner as TIBDataSet).SelectSQL.Text = ''))) then ...

instead of this code
Code: Pascal  [Select][+][-]
  1.   if not (AGenerator.Owner is TIBTable) and
  2.    ((AGenerator.Owner is TIBQuery and ((AGenerator.Owner as TIBQuery).SQL.Text = '')) or
  3.    (AGenerator.Owner is TIBDataSet and ((AGenerator.Owner as TIBDataSet).SelectSQL.Text = ''))) then ...

solves the this problem. Please make the necessary changes to the code.
Win10 LTSC x64/Deb 11 amd64(gtk2/qt5)/Darwin Cocoa (Monterey):
Lazarus x32/x64 2.3(trunk); FPC 3.3.1 (trunk), FireBird 3.0.10; IBX by TonyW

Sorry for my bad English, I'm using translator ;)

tonyw

  • Sr. Member
  • ****
  • Posts: 321
    • MWA Software
Re: IBX 2.3.3 is now available for download
« Reply #2 on: April 16, 2020, 04:16:15 pm »
Looks like the operator precedence order has changed in the next FPC release.

IBX should continue to compile under FPC 3.0.4 and that is still the default compiler for Lazarus 2.0.8.

I will update the code for the next release of IBX. This is in test at present and is intended to support Firebird 4 extensions. However, I would like to see Firebird 4 Beta 2 release before releasing a new version of iBX as there has been a significant change to the version numbering for the IUtil client library interface between beta 1 and beta 2 as well as some new TIME ZONE related functions that are only present in the Beta 2 release.

zoltanleo

  • Sr. Member
  • ****
  • Posts: 488
Re: IBX 2.3.3 is now available for download
« Reply #3 on: April 16, 2020, 06:08:59 pm »
Hi Tony. Thank U for the answer.

I think it is unlikely that this will violate backward compatibility with the stable version of the compiler if you add a couple of statement brackets to the code. But of course, it's up to you.  ;)

Win10 LTSC x64/Deb 11 amd64(gtk2/qt5)/Darwin Cocoa (Monterey):
Lazarus x32/x64 2.3(trunk); FPC 3.3.1 (trunk), FireBird 3.0.10; IBX by TonyW

Sorry for my bad English, I'm using translator ;)

rvk

  • Hero Member
  • *****
  • Posts: 6169
Re: IBX 2.3.3 is now available for download
« Reply #4 on: April 16, 2020, 06:24:06 pm »
Looks like the operator precedence order has changed in the next FPC release.

That's weird. 'is' was always after 'and' according to the documentation.

https://www.freepascal.org/docs-html/ref/refch12.html

Probably a bug in the older versions which is fixed now.


zoltanleo

  • Sr. Member
  • ****
  • Posts: 488
Re: IBX 2.3.3 is now available for download
« Reply #5 on: April 16, 2020, 06:40:26 pm »
Probably a bug in the older versions which is fixed now.
Most likely this is so. Another fork of IBX from Rik also shows the same error in the same unit
« Last Edit: April 16, 2020, 06:51:27 pm by zoltanleo »
Win10 LTSC x64/Deb 11 amd64(gtk2/qt5)/Darwin Cocoa (Monterey):
Lazarus x32/x64 2.3(trunk); FPC 3.3.1 (trunk), FireBird 3.0.10; IBX by TonyW

Sorry for my bad English, I'm using translator ;)

Zoran

  • Hero Member
  • *****
  • Posts: 1831
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: IBX 2.3.3 is now available for download
« Reply #6 on: April 17, 2020, 09:37:20 am »
Hello,

After statement is prepared, the GetStatementType method of IStatement interface returns the type of the statement, which is declared in IB unit:
Code: Pascal  [Select][+][-]
  1.   TIBSQLStatementTypes =
  2.                  (SQLUnknown, SQLSelect, SQLInsert,
  3.                   SQLUpdate, SQLDelete, SQLDDL,
  4.                   SQLGetSegment, SQLPutSegment,
  5.                   SQLExecProcedure, SQLStartTransaction,
  6.                   SQLCommit, SQLRollback,
  7.                   SQLSelectForUpdate, SQLSetGenerator);
  8.  

So, there are 14 possible values (in range 0..13).
However, I noticed that statements "savepoint ...", "rolback to savepoint ...", "release savepoint..." return the type which is "out of bounds" (they get value 14).

This seems to be the reason why a Dataset (of type TIBDataSet) raises exception if you try Dataset.ExecSQL.
However, the API still seems to work, so, as a workaround we can do this:
Code: Pascal  [Select][+][-]
  1. var
  2.   ST: Integer;
  3.   SomeStatement: String;
  4. ...
  5.  
  6. // At this point, Dataset is created, and SomeStatement contains some SQL text.
  7. Dataset.SelectSQL.Text := SomeStatement;
  8. Dataset.Prepare;
  9. ST := Integer(FQuery.StatementType);
  10.  
  11. if ST > Integer(High(TIBSQLStatementTypes)) then begin
  12.   DataSet.UnPrepare; // Give up the dataset, go to api.
  13.   DataSet.Database.Attachment.ExecImmediate(
  14.       DataSet.Transaction.TransactionIntf,
  15.       SomeStatement
  16.       );
  17. end else
  18.   DataSet.ExecSQL;
  19.  

So, one more statement type should be added to the enumeration (you can call it SQLSavePoint or something like that).

« Last Edit: April 17, 2020, 09:40:38 am by Zoran »

tonyw

  • Sr. Member
  • ****
  • Posts: 321
    • MWA Software
Re: IBX 2.3.3 is now available for download
« Reply #7 on: April 17, 2020, 11:12:16 am »
Probably a bug in the older versions which is fixed now.
Most likely this is so. Another fork of IBX from Rik also shows the same error in the same unit
If it is a compiler bug fixed in fpc 3.2 then it goes back a long way. I have checked back through the SVN updates to IBX and the sloppy syntax was the result of a patch introduced in 2011. It's odd because I would expect "IS" to have a lower precedence than "AND" given that other operators behave similarly, and I would normally use parenthesis in this case. Looks like the compiler let me get away with a mis-typing and it wasn't noticed until now.

tonyw

  • Sr. Member
  • ****
  • Posts: 321
    • MWA Software
Re: IBX 2.3.3 is now available for download
« Reply #8 on: April 17, 2020, 11:20:18 am »
Hello,

After statement is prepared, the GetStatementType method of IStatement interface returns the type of the statement, which is declared in IB unit:
Code: Pascal  [Select][+][-]
  1.   TIBSQLStatementTypes =
  2.                  (SQLUnknown, SQLSelect, SQLInsert,
  3.                   SQLUpdate, SQLDelete, SQLDDL,
  4.                   SQLGetSegment, SQLPutSegment,
  5.                   SQLExecProcedure, SQLStartTransaction,
  6.                   SQLCommit, SQLRollback,
  7.                   SQLSelectForUpdate, SQLSetGenerator);
  8.  

So, there are 14 possible values (in range 0..13).
However, I noticed that statements "savepoint ...", "rolback to savepoint ...", "release savepoint..." return the type which is "out of bounds" (they get value 14).

This seems to be the reason why a Dataset (of type TIBDataSet) raises exception if you try Dataset.ExecSQL.
However, the API still seems to work, so, as a workaround we can do this:
Code: Pascal  [Select][+][-]
  1. var
  2.   ST: Integer;
  3.   SomeStatement: String;
  4. ...
  5.  
  6. // At this point, Dataset is created, and SomeStatement contains some SQL text.
  7. Dataset.SelectSQL.Text := SomeStatement;
  8. Dataset.Prepare;
  9. ST := Integer(FQuery.StatementType);
  10.  
  11. if ST > Integer(High(TIBSQLStatementTypes)) then begin
  12.   DataSet.UnPrepare; // Give up the dataset, go to api.
  13.   DataSet.Database.Attachment.ExecImmediate(
  14.       DataSet.Transaction.TransactionIntf,
  15.       SomeStatement
  16.       );
  17. end else
  18.   DataSet.ExecSQL;
  19.  

So, one more statement type should be added to the enumeration (you can call it SQLSavePoint or something like that).
Thanks for pointing this out. I can confirm that "SQLSavePoint" is missing off the end of the  TSQLStatementTypes enumeration in IB.pas. Looks like another bug that goes back a long way. I have checked the development version of the Firebird code and there appear to be no other missing elements to the enumeration. In the next version the type will be defined as

TIBSQLStatementTypes =
                 (SQLUnknown, SQLSelect, SQLInsert,
                  SQLUpdate, SQLDelete, SQLDDL,
                  SQLGetSegment, SQLPutSegment,
                  SQLExecProcedure, SQLStartTransaction,
                  SQLCommit, SQLRollback,
                  SQLSelectForUpdate, SQLSetGenerator,
                  SQLSavePoint);     

In the meantime feel free to patch your own source for fbintf/IB.pas.

Zoran

  • Hero Member
  • *****
  • Posts: 1831
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: IBX 2.3.3 is now available for download
« Reply #9 on: April 17, 2020, 11:16:16 pm »
Today trunk does not compile.

Quote
IBBlob.pas(114,6) Fatal: Cannot find IBMessages used by IBBlob. Check search path of package ibnongui, try a clean rebuild, check implementation uses sections..

(Linux Mint 19.3, 64-bit, Xfce, Lazarus fixes 2.0.9, FPC 3.0.4)

tonyw

  • Sr. Member
  • ****
  • Posts: 321
    • MWA Software
Re: IBX 2.3.3 is now available for download
« Reply #10 on: April 18, 2020, 12:02:10 am »
Today trunk does not compile.

Quote
IBBlob.pas(114,6) Fatal: Cannot find IBMessages used by IBBlob. Check search path of package ibnongui, try a clean rebuild, check implementation uses sections..

(Linux Mint 19.3, 64-bit, Xfce, Lazarus fixes 2.0.9, FPC 3.0.4)
The file IBMessages.pas did not make it across when the development repository was synced with the public one. Now fixed.

I will probably release updated archives for 2.3.4 tomorrow.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5486
  • Compiler Developer
Re: IBX 2.3.3 is now available for download
« Reply #11 on: April 18, 2020, 10:50:33 am »
Looks like the operator precedence order has changed in the next FPC release.

IBX should continue to compile under FPC 3.0.4 and that is still the default compiler for Lazarus 2.0.8.

It is a relative recent fix and is also mentioned here. Maybe we'll also merge it back to 3.2.

Speaking of which: I'd advise to test with FPC 3.2.0 RC1 as well (there is a Lazarus 2.0.8 build providing the RC). If you encounter a bug in there now we have the chance to fix it before the release. Once 3.2.0 is out you'll have to wait till 3.2.2.

 

TinyPortal © 2005-2018