Recent

Author Topic: MWA Software's Firebird Pascal API is now available  (Read 6801 times)

tonyw

  • Full Member
  • ***
  • Posts: 174
    • MWA Software
MWA Software's Firebird Pascal API is now available
« on: December 07, 2016, 12:01:19 pm »
MWA Software is pleased to announce the release of its Firebird Pascal API package (fbintf). This package has been derived from IBX for Lazarus and is part of the IBX2 development (see separate announcement). The intent is to provide common Pascal language bindings to the Firebird API that are independent of the Firebird API version. The IBX derived code is licensed under the Interbase Public License, with the remaining code licensed under the Initial Developer's Public License.

The fbintf package provides the Firebird API in a format where all data types for SQL data, interface parameters and results are native Pascal types, including all parameter blocks and database information. The Pascal API is pitched at a similar level and purpose to the IBPP Firebird API provided to the C++ world. The package is intended to be suitable for use on any platform supported by the Free Pascal Compiler. It is a required dependency for version 2 onwards of IBX for Lazarus, and is provided as both a standalone package and as part of IBX2.

It is available for download from http://www.mwasoftware.co.uk/ibx2.

The Firebird Pascal API is intended to be simple to use and to place the minimum burden on the API user when it comes to managing the Firebird client library and the various Pascal objects that are created to provide the API. It is implemented as reference counted COM interfaces which, for the API user, are as easy to use as other managed types such as AnsiStrings and dynamic arrays. The user only needs to worry about accessing and using the interface; disposing of interfaces is performed automatically whenever an interface goes out of scope. It is intended to be a full implementation of the Firebird API, including events, services, blobs and arrays.

Two interface implementations are provided. One is for the new Firebird 3 Client API and the other for the legacy Firebird Client API used for Firebird 2.x and earlier. The Firebird 3 API implementation is used whenever possible and the older API only if the Firebird 3 API is not available.

The package is supported by an 89 page User Guide and a comprehensive test suite. The test suite includes 16 separate tests covering 104 individual test objectives. It is console mode and run from a batch script with automatic comparison against a reference results log. It uses the “heaptrc” unit to check for memory leaks. The objective of the test suite is to provide confidence in the correct operation of the software over are variety of platforms and with only expected variances between the two Firebird APIs. It is also intended to be the basis for regression testing. Documentation on the use of the test suite is provided with the package.

Given the level at which the package works and the power of Pascal “interfaces”, embedded SQL statements are possible, such as:

Attachment.ExecuteSQL([isc_tpb_write, isc_tpb_nowait,isc_tpb_concurrency],
                                                                'Execute Procedure DELETE_EMPLOYEE ?', [8]);

and

writeln('Employee Count = ',
   MyAttachment.OpenCursorAtStart('Select count(*) from EMPLOYEE')[0].AsInteger);


The fbintf package may be used on its own or as part of IBX and has the potential to provide a common Firebird API to all FPC database applications.

Groffy

  • Full Member
  • ***
  • Posts: 210
Re: MWA Software's Firebird Pascal API is now available
« Reply #1 on: December 08, 2016, 09:25:32 am »
Thank your for your great work!

Currently its not compiling under Lazarus trunk, complaining about missing unit FBMessages. With Lazarus 1.6.2 its fine.


Best regards
Linux Mint 18.3 - KDE / Windows 10 / Lazarus 2.0.6 / trunk -qt

Thaddy

  • Hero Member
  • *****
  • Posts: 10516
Re: MWA Software's Firebird Pascal API is now available
« Reply #2 on: December 08, 2016, 10:01:23 am »
Looks nice.
One remark: personally I think it is a mistake to have used objfpc mode for the units, especially regarding the generics syntax.
It would be easier to maintain cross-platform and cross-compiler (Delphi and FPC/Laz) code if the {$mode delphi} syntax for generics was used.
You are over-complicating things ;) Furthermore, there are a lot of people that use Delphi AND FPC (this could be a majority).
Almost all of them always use mode Delphi.
« Last Edit: December 08, 2016, 10:04:17 am by Thaddy »

tonyw

  • Full Member
  • ***
  • Posts: 174
    • MWA Software
Re: MWA Software's Firebird Pascal API is now available
« Reply #3 on: December 08, 2016, 10:12:18 am »
Thank your for your great work!

Currently its not compiling under Lazarus trunk, complaining about missing unit FBMessages. With Lazarus 1.6.2 its fine.


Best regards
I've just tried rebuilding with svn (http://svn.freepascal.org/svn/lazarus/trunk) revision 53597 and had no problems. FBMessages is included in the fbintf/client directory. Have you deleted it by accident?

tonyw

  • Full Member
  • ***
  • Posts: 174
    • MWA Software
Re: MWA Software's Firebird Pascal API is now available
« Reply #4 on: December 08, 2016, 10:19:16 am »
Looks nice.
One remark: personally I think it is a mistake to have used objfpc mode for the units, especially regarding the generics syntax.
It would be easier to maintain cross-platform and cross-compiler (Delphi and FPC/Laz) code if the {$mode delphi} syntax for generics was used.
You are over-complicating things ;) Furthermore, there are a lot of people that use Delphi AND FPC (this could be a majority).
Almost all of them always use mode Delphi.
It's a valid point. I'll look into it.

Thaddy

  • Hero Member
  • *****
  • Posts: 10516
Re: MWA Software's Firebird Pascal API is now available
« Reply #5 on: December 08, 2016, 10:33:23 am »
Note that because objfpc had generics before Delphi had, the syntax is like it is.
I know a lot of people - including me - consider it legacy, although that is for the purists debatable ;)

Groffy

  • Full Member
  • ***
  • Posts: 210
Re: MWA Software's Firebird Pascal API is now available
« Reply #6 on: December 08, 2016, 11:46:44 am »
I've just tried rebuilding with svn (http://svn.freepascal.org/svn/lazarus/trunk) revision 53597 and had no problems. FBMessages is included in the fbintf/client directory. Have you deleted it by accident?

Just tried with revision 53597 & 53599 - still not compiling. FBMessages is in fbintf/client.

Any idea what can be configured false on my side?


With best regards
Linux Mint 18.3 - KDE / Windows 10 / Lazarus 2.0.6 / trunk -qt

tonyw

  • Full Member
  • ***
  • Posts: 174
    • MWA Software
Re: MWA Software's Firebird Pascal API is now available
« Reply #7 on: December 08, 2016, 12:05:38 pm »
I've just tried rebuilding with svn (http://svn.freepascal.org/svn/lazarus/trunk) revision 53597 and had no problems. FBMessages is included in the fbintf/client directory. Have you deleted it by accident?

Just tried with revision 53597 & 53599 - still not compiling. FBMessages is in fbintf/client.

Any idea what can be configured false on my side?

I would suggest the following as a basic sanity check. Open a console window and change the directory to fbintf/testsuite. Then run "./runtest.sh" (runtest.bat on Windows). This should compile and run the testsuite independent of Lazarus. it only needs FPC to compile correctly. Note: to run correctly, the testsuite also requires a local Firebird server and the employee database to be set up correctly. However, at least this will prove the source code files are all there. More info on running  the testsuite is in doc/TestSuite.pdf.

Next I would check the fbintf package in Package Manager. This should show FBMessages.pas in the client directory. The compiler path options should also show the "client" directory in the compiler options "other units" path. If this is all correct and selecting "compile" in Package Manager still gives an error then I have run out of ideas. Perhaps it would be worth getting a clean copy from svn and trying again.





marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8780
  • FPC developer.
Re: MWA Software's Firebird Pascal API is now available
« Reply #8 on: December 08, 2016, 12:10:42 pm »
Note that because objfpc had generics before Delphi had, the syntax is like it is.

Strictly speaking, Delphi had it first in the  D2007 .NET2 target. That fixated the later syntax for native too.

Graeme

  • Hero Member
  • *****
  • Posts: 1430
    • Graeme on the web
Re: MWA Software's Firebird Pascal API is now available
« Reply #9 on: December 08, 2016, 01:40:07 pm »
One remark: personally I think it is a mistake to have used objfpc mode for the units, especially regarding the generics syntax.
It would be easier to maintain cross-platform and cross-compiler (Delphi and FPC/Laz) code if the {$mode delphi} syntax for generics was used.
You do realise where you are right? The FPC and Lazarus forum! Who the hell cares about Delphi these days. FPC can do everything Delphi can and more.

To quote the original poster:
   "The package is intended to be suitable for use on any platform supported by the Free Pascal Compiler."

Quote
You are over-complicating things ;)
Please! I think the objfpc mode is MUCH better the the delphi mode. It has a more strict and "correct" (Pascal-like) language syntax, and the objfpc generics syntax looks just fine to me - nothing more complicated that what Delphi does.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

Thaddy

  • Hero Member
  • *****
  • Posts: 10516
Re: MWA Software's Firebird Pascal API is now available
« Reply #10 on: December 08, 2016, 04:29:53 pm »
You do realise where you are right? The FPC and Lazarus forum! Who the hell cares about Delphi these days. FPC can do everything Delphi can and more.
Yes. You are one of those excepts I refered to. Even some core FPC developers prefer Delphi mode ;)

Quote from: Graeme
Please! I think the objfpc mode is MUCH better the the delphi mode. It has a more strict and "correct" (Pascal-like) language syntax, and the objfpc generics syntax looks just fine to me - nothing more complicated that what Delphi does.

Well, I have a different opinion. As do many on the forum. As do some core developers.
But feel free to use your favorite mode. If it is only FPC you release for, that is. That is not the case here.
Here a specific release is prepared for objfpc dialect, where there really is no necessity to do so.
It is in the interest of the releasing party that his code base can be as tight as possible without the need for a separate release in an exotic dialect.

It is also in the interest of the average user, most of whom come from Delphi.

On topic:
Tonyw has a release for both Delphi and Freepascal/Lazarus.
He can better unify his code base is my suggestion.
In mode delphi FPC is almost 100% compatible upto and including Delphi 2010 and has good, workable, compatibility with higher versions.

It is entirely possible that his Delphi release already works in FPC as-is. This is often the case nowadays.
« Last Edit: December 08, 2016, 04:37:45 pm by Thaddy »

Graeme

  • Hero Member
  • *****
  • Posts: 1430
    • Graeme on the web
Re: MWA Software's Firebird Pascal API is now available
« Reply #11 on: December 08, 2016, 04:37:02 pm »
Here a specific release is prepared for objfpc dialect, where there really is no necessity to do so.
And no necessity to force him to use Mode Delphi either.

Why must we (the FPC community) always cater for the dwindling Delphi community, when they and EMBT don't give a toss about Free Pascal. If they want to use our code, let them install FPC - it's FREE! The other way round is not true, and very expensive at that.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

Thaddy

  • Hero Member
  • *****
  • Posts: 10516
Re: MWA Software's Firebird Pascal API is now available
« Reply #12 on: December 08, 2016, 04:39:44 pm »

And no necessity to force him to use Mode Delphi either.

I am not forcing anything. I am refering to the fact thathe can avoid double work. Seems rather important to me!  >:D
Hopeless. Last post by me on this dialect subject.

Except that the modes are on unit level. The end-user can use any mode he likes ;)
« Last Edit: December 08, 2016, 04:43:07 pm by Thaddy »

srcstorm

  • New Member
  • *
  • Posts: 21
Re: MWA Software's Firebird Pascal API is now available
« Reply #13 on: December 25, 2016, 07:08:23 pm »
Here a specific release is prepared for objfpc dialect, where there really is no necessity to do so.
And no necessity to force him to use Mode Delphi either.

Why must we (the FPC community) always cater for the dwindling Delphi community, when they and EMBT don't give a toss about Free Pascal. If they want to use our code, let them install FPC - it's FREE! The other way round is not true, and very expensive at that.

How about introducing a new mode like objcommon? Nowadays some library developers are using FPC as their main platform but still want to retain delphi compatibility. This mode should ensure that a subset of mode objfpc is being used so that dcc can also compile it.

Even if it ends up as just an alias to mode delphi, it may be helpful to clarify the intention.

tonyw

  • Full Member
  • ***
  • Posts: 174
    • MWA Software
Re: MWA Software's Firebird Pascal API is now available
« Reply #14 on: December 26, 2016, 11:03:48 am »
Actually, I have been investigating how easy it would be to make the package truly Delphi compatible and it's a lot more than just "mode delphi". Getting it to compile with mode delphi was easy. However, generics work very differently in Delphi such that I just can't do in Delphi (Berlin edition) what I can do in FPC. In practice, to convert the package, all generics have to be expanded into discrete classes.

There are also many other differences, mainly due to Delphi making direct use of the Win API. In summary, a common source is possible but is much less elegant than an FPC only version.

 

TinyPortal © 2005-2018