Recent

Author Topic: dBase in Lazarus  (Read 8552 times)

iret

  • New Member
  • *
  • Posts: 15
Re: dBase in Lazarus
« Reply #30 on: September 16, 2022, 03:31:54 pm »
Hello,

thanks for all the people that tried to help with my TDbf problems.
Here's a short of my current findings for anybody also struggling with dbase files:

  • My project is now working for 4 weeks without major issues (fingers crossed)
  • Although it is working, I would never recommend to use dbase files in any new development
  • TDbf from the fpc repositories has issues with index files, the version at sourceforge contains fixes for those

        ==> Use TDbf from https://sourceforge.net/p/tdbf/code/HEAD/tree/trunk/)
        @WP: Thanks a lot for your tip, this was my breakthrough
  • The documentation of TDbf (s. sourceforge) clearly states that "locking" should work and interoperability with BDE is also a goal  of the project
  • I suspect another index bug in TDbf, concerning indices on an integer column. It's too early to file a bug report but I will investigate some more time on this topic.

For those of you still wondering why I'm working with dbase files in this project:
  • The original project started back in the 90's on a Novell server with DOS clients
  • The software is vital for production: It manages the work of 8 different cable cutting machines and also has an interface to the ERP software and different proprietary industrial printers
  • Replacing the system with another database solution would mean approx. >500 working hours, including the risk of production failure
  • We are currently integrating a new machine and taking the opportunity to slowly prepare the software for a new database environment.
   
Bets regards


avra

  • Hero Member
  • *****
  • Posts: 2532
    • Additional info
Re: dBase in Lazarus
« Reply #31 on: September 16, 2022, 06:26:17 pm »
When I made single user single instance Delphi applications using dbase files long time ago, in app initialization I checked if last exit from application was regular, and if it wasn't I recreated indexes. Check was very simple - create file on app start, delete it on app exit, and on app start recreate indexes if file existed. That solved many dbase problems I faced and app was running well for at least 15 years.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

rvk

  • Hero Member
  • *****
  • Posts: 6585
Re: dBase in Lazarus
« Reply #32 on: September 16, 2022, 06:29:40 pm »
When I made single user single instance Delphi applications using dbase files long time ago, in app initialization I checked if last exit from application was regular, and if it wasn't I recreated indexes.
Hard to do in a multi user environment where there are also BDE programs accessing the same database at the same time (like the case is with TS).

Arioch

  • Sr. Member
  • ****
  • Posts: 421
Re: dBase in Lazarus
« Reply #33 on: September 16, 2022, 07:59:09 pm »
when i was doing DBF in Delphi 5 - i remember Torry Pages had VKDBF library too

all in all i ended with TDbf and even made some patches to it back then, but VK DBF was close second

additionally, back then there was a rather well-known product, Database Advantage, building an SQL layer on top of DBF files, whic his similar to what BDE LocalSQL was provided but allegedly more advanced

Arioch

  • Sr. Member
  • ****
  • Posts: 421
Re: dBase in Lazarus
« Reply #34 on: September 16, 2022, 08:02:35 pm »
Hard to do in a multi user environment where there are also BDE programs accessing the same database at the same time (like the case is with TS).

BDE...

there can be also Mcirosoft Excel, and Microsoft Acccess and Microsoft FoxBase/FoxPro

and they support different flavours of DBF (like, excel was using DBF version 3 while ODBC FoxPro driver used DBF version 5, and those formats had different ways to specify Russian language and differnt charsets for Russian...). And probably different locking semantics too

Really, when it goes above write-copye-consume, but about continuous behavior, you'd better stick to some library...  Can you just call BDE functions from Lazarus instead?

iret

  • New Member
  • *
  • Posts: 15
Re: dBase in Lazarus
« Reply #35 on: November 03, 2022, 03:22:30 pm »
Finally I found a bug concerning indices on an integer column in TDbf. You can see the details, testprogram and fix here:

https://sourceforge.net/p/tdbf/bugs/109/



wp

  • Hero Member
  • *****
  • Posts: 12460
Re: dBase in Lazarus
« Reply #36 on: November 03, 2022, 03:53:09 pm »
The TDbf version coming with FPC is a fork of the sourceforge version to which you sent your patch. If you want it to be included in FPC you must study the issue again with the FPC sources and submit your patch as a bugreport to Gitlab (see sidebar at the left of the forum).

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: dBase in Lazarus
« Reply #37 on: November 03, 2022, 04:33:19 pm »
Hi!

The bug in TDbf concerning the index is  more than 15 years old and still not fixed.

Serious advice: Use TDbf only in readonly mode. And don't try to use it together with the BDE! Dangerous!

Use TDbf to export the data to a CSV file. And then import the data to some kind of SQL base.

Winni


iret

  • New Member
  • *
  • Posts: 15
Re: dBase in Lazarus
« Reply #38 on: November 04, 2022, 10:33:02 am »

The version from sourceforge (trunk) is working with read/write since 8 weeks in our production environment. No major issues, except that ist to slow because of the bug I have fixed now.

The FPC fork has much more issues with indices, it has corrupted my index file regularly. Unfortunately I have not the knowlede and not the time to fix this, although I would like to do that because of the different licence compared to the sourceforge repository. (s. https://forum.lazarus.freepascal.org/index.php/topic,60100.msg448775.html)

@Winni: As I already stated before, I have to stick with dbase files for the moment. I'm aware of the issues and  I'm willing to fix them as far as it is necessary for my project.

 

TinyPortal © 2005-2018