Jump to content
Jasonjac2

The Delphi Parser - FIBPlus, BDE, legacy Migration

Recommended Posts

Hi All,

 

I have an old system:

  •  2 x EXEs (D7)
  • 330K combined lines of code
  • BDE
  • FibPlus
  • IBX
  • JVCL
  • JCL
  • TMS
  • SMExport (very small amount)
  • Custom Components (very small part)
  • CNWizards – logging – (very small part)

I want to end up with on DAC (FireDAC unless anyone talks me out of it) and D10.4

 

I have invested in "The Delphi Parser".  The author is being very helpful, but ultimately for FIBPlus, I am going to get my hands dirty and modify the script to teach it what to convert into what.  I was wondering if anyone else has travelled this path or is about to.  Things I was interested in.  How you did it, what gotchas you got etc.

 

I like the idea of a "brighter than Grep" parser that understands the structure of a Delphi App. 

Share this post


Link to post

Hi,

Sorry Fr0sT.Brutal I didn't explain the background very well.  I was hoping that someone had done some work on migrating FibPlus code to a supported data access platform and at the same time was sharing my thoughts on migrating my 300K+ lines of code from D7 to D10.4.

 

See (*) notes at the bottom.

Update: While I have a hiccup with The Delphi Parser (1), I thought I would try and split the problem into:

  • JVCL / JCL - Just get that installed (2)
  • CnWiazrds - Just get that installed (3)
  • BDE & IBX (as I am hoping the Delphi Parser will sort almost all of that for me)
  • FibPlus - Hoping to use the Delphi Parser, but need to know what needs translating
  • Everything else

I took the simplest part of the system that I could get to compile in isolation and all the dependent units (basically the logging into the database and the datamodule that does the auditing, but required about 4 more units), got it compiling under D7, then moved to D10.4.  Of course, without FIbPlus, it didn't compile, so I went back and forth creating Mocks by:

  • 10.4 Attempt to Compile
  • Take the error (undeclared class / property / method), goto the line and copy the exact line
  • Go back to D7, find the line, ctrl click to the declaration, record the unit,  etc
  • Go back to 10.4 and create the stubb in the correct unit.
  • Repeat until compile.

This has left me with about 8 new units that mirror the declaration of the missing classes, but with no actual code.  It compiles and of course, I can't view the DFMs in the designer as there are none of the fibplus components installed in D10.4.

 

Of course, there could be lots of component properties stored in the .dfm's that doesn't exist in the code, so even though it now compiles, it won't run as the first property it finds as is streams the .dfms in is going to stop it.

 

So next up was to use GExperts component to code back in D7 to pull in the different types of FIB+ components in and copy these to some extra unit in my new 10.4.

Did this and got those to compile, so in my FibPlus mock units I have things like this:

  TpFIBDatabase = class(TFIBDatabase)
  public
    DatabaseName : String;
    Connected : boolean;
    DBParams : TStrings;
    SQLDialect : Integer;
    procedure close;
    procedure open;
  public // dfm Only
    DBName : String;
    DefaultTransaction : TFIBTransaction;
    Timeout : integer;
    DesignDBOptions : TDesignDBOptions;
    WaitForRestoreConnect : integer;

  end;

So next up:

  • work out what these should map onto in FirDAC
  • Then either teach Delphi Parser to convert to FireDAC OR inherit these components from the suitable FirDAC components and add in mapping code.
    • Oren of The Delphi Parser and it looks like is happy to give me a hand / work out the mapping with some examples.

 

I realise there aren't any questions in this one, but I searched and searched and couldn't find any real help with the FIBPlus migration, so these notes may be of some help to someone, sometime. 

 

I'll post another update when it compiles and actually accesses the data!  Have a good week all.

 

 

(1) Delphi Parser- Raised on Friday PM, so not a negative thing as I know the Author is very responsive, so expect to get that sorted when he is back in work

Had contact with the Author over the weekend and managed to get a conversion done, which is great.  Now I need time to see how well it managed BDE -> FIREDAC conversion.

(2) JVCL / JCL -  had a strange one with the debug library paths confusing the compiler and pointing to the older version that was installed with Tokyo - not sure if something got dragged over with the upgrade, but meant I: refreshed my memory about the order that paths are used; cleaned my paths up a bit.

(3) CnWizards - strange, the compiler directive doesn't seem to be working: 

 

 

Share this post


Link to post

I've no idea what Delphi Parser is but AFAIK FIBPlus are available in more or less recent version. IBX is included in Delphi RTL so almost no need to change. BDE is of course dead.

Anyway as you're migrating from D7 the most serious problem you'll likely have is Ansi=>Unicode transfer. After that all other changes will look like  piece a cake.

Share this post


Link to post
1 hour ago, Fr0sT.Brutal said:

I've no idea what Delphi Parser is but AFAIK FIBPlus are available in more or less recent version. IBX is included in Delphi RTL so almost no need to change. BDE is of course dead.

Anyway as you're migrating from D7 the most serious problem you'll likely have is Ansi=>Unicode transfer. After that all other changes will look like  piece a cake.

Hi,

OK, cool, "FIBPlus are available in more or less recent version." - where is this, I could only find a reference on:  https://shareappscrack.com/fibplus/?token=75016374 which worried me a bit as it looks like a crack site.

 

BDE - I actually installed the BDE a while back, but don't think the VCL components actually exist, so I agree.... completely dead 🙂

 

" Ansi=>Unicode transfer" - in practical terms, I am not sure what this is going to mean to me.

 

Another issue is the system is still on Dialect 1 of an old version of FB.  I need to work out the migration path for that also, but I thought to get it all over to latest Delphi and then worry about that.

 

So Devrace aren't operating anymore, so would you stick with FIbPlus or migrate away?  I don't see many dev's using it or a lot of recent hits regarding it, so worry that the ongoing maintenance for me might be high - but I would be keen to know if there is a group of dev's still using it.   I loved FIB & FIBPlus by the way and have excellent memories of meeting up with Serge (sp) and Marina at the FB Conference.

 

Regards & keen to get your input. Thank you for taking the time to reply.

 

"The Delphi Parser" is a 3rd party tool that has scripts for converting Delphi code, so the classic is BDE -> FireDAC, it is more than refind and it understands context and the author can tweak the system to add new types of conversion for the .pas and .dfm.   It is interesting stuff and I think much needed.  Historically it has been out of my price range, but recently there have been promotions and the author is doing a webinar with EMBT this week I think.

 

Share this post


Link to post
1 hour ago, Jasonjac2 said:

OK, cool, "FIBPlus are available in more or less recent version." - where is this, I could only find a reference on:  https://shareappscrack.com/fibplus/?token=75016374 which worried me a bit as it looks like a crack site.

I found this https://github.com/madorin/fibplus

1 hour ago, Jasonjac2 said:

" Ansi=>Unicode transfer" - in practical terms, I am not sure what this is going to mean to me.

Starting from D2009, string contains 2-byte widechars. Depending on code, transition could take from minutes to months (if many code relies on assumption that Char is 1-byte sized).

1 hour ago, Jasonjac2 said:

Another issue is the system is still on Dialect 1 of an old version of FB.  I need to work out the migration path for that also, but I thought to get it all over to latest Delphi and then worry about that.

There was no critical compatibility breaks in dialect 3. Again, depending on code and complexity of queries, it could take from simple structure clone and data pumping to long and hard process.

1 hour ago, Jasonjac2 said:

So Devrace aren't operating anymore, so would you stick with FIbPlus or migrate away?  I don't see many dev's using it or a lot of recent hits regarding it, so worry that the ongoing maintenance for me might be high - but I would be keen to know if there is a group of dev's still using it.   I loved FIB & FIBPlus by the way and have excellent memories of meeting up with Serge (sp) and Marina at the FB Conference.

Again it depends on how hard your code is tied to data access components. In theory, changing them is a matter of several hours. Nowadays I'd advice to use a maintained library like *DAC or Zeos

Edited by Fr0sT.Brutal

Share this post


Link to post
On 8/24/2020 at 1:00 PM, Fr0sT.Brutal said:

I found this https://github.com/madorin/fibplus

Starting from D2009, string contains 2-byte widechars. Depending on code, transition could take from minutes to months (if many code relies on assumption that Char is 1-byte sized).

There was no critical compatibility breaks in dialect 3. Again, depending on code and complexity of queries, it could take from simple structure clone and data pumping to long and hard process.

Again it depends on how hard your code is tied to data access components. In theory, changing them is a matter of several hours. Nowadays I'd advice to use a maintained library like *DAC or Zeos

You star - I don't know how I missed the FibPlus Repo.  See "Later section"

 

Update - I started this a couple of days ago and forgot to post: While I have a hiccup with The Delphi Parser (1), I thought I would try and split the problem into:

  • JVCL / JCL - Just get that installed (2)
  • CnWizards - Just get that installed (3)
  • BDE & IBX (as I am hoping the Delphi Parser will sort almost all of that for me)
  • FibPlus - Hoping to use the Delphi Parser, but need to know what needs translating
  • Everything else

 

 

 

(1) - Raised on Friday PM, so not a negative thing as I know the Author is very responsive, so expect to get that sorted when he is back in work

(2) JVCL / JCL -  had a strange one with the debug library paths confusing the compiler and pointing to the older version that was installed with Tokyo - not sure if something got dragged over with the upgrade, but meant I: refreshed my memory about the order that paths are used; cleaned my paths up a bit.

(3) CnWizards - strange, the compiler directive doesn't seem to be working in 10.4

 

.... Some time later....... 27th August...

 

I actually installed the BDE & BDE components in D10.4 and forked the FibPlus Repo.  This isn't to continue with either in 10.4, but means I can move all migration effort to the 10.4 machine and not worry.  To this end I have brought the project up in the IDE and realised I also use : 2 components I wrote, a TVersionControl and WPTools from WPCubed.

 

Still planning on the scripted migration.  Thanks for your time and hope this might help someone else some day.

 

I'll try and do another update over the weekend.

 

Regards, JAC

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×