Recent

Author Topic: BufferDataset error Save and Load from file  (Read 2282 times)

egsuh

  • Hero Member
  • *****
  • Posts: 1614
Re: BufferDataset error Save and Load from file
« Reply #15 on: September 25, 2024, 05:49:12 am »
I think the problems come from TFields,

   MDBtnsBtnName
   MDBtnsCaption
   MDBtnsPageNo
   MDBtnsMacro

and so on. When I removed them, all works fine, except saving the file. 

-------------

I have dropped all the TFields, and added them again and the program works fine, including saving the database.



« Last Edit: September 25, 2024, 06:09:38 am by egsuh »

rvk

  • Hero Member
  • *****
  • Posts: 6758
Re: BufferDataset error Save and Load from file
« Reply #16 on: September 25, 2024, 10:20:02 am »
I have dropped all the TFields, and added them again and the program works fine, including saving the database.
Can you compare the lfm (the part with the fields) with the original one?
I wonder why it would work after that.

(And what version of Lazarus?)

TRon

  • Hero Member
  • *****
  • Posts: 4377
Re: BufferDataset error Save and Load from file
« Reply #17 on: September 25, 2024, 10:20:09 am »
Which should be fixed in version 3.4, shouldn't it?
Are you sure that Lazarus 3.4 came with a new(er) version of FPC ?  ;D

I am not sure it made fixes though (and I haven't seen fixes/trunk mentioned by TS).
Today is tomorrow's yesterday.

rvk

  • Hero Member
  • *****
  • Posts: 6758
Re: BufferDataset error Save and Load from file
« Reply #18 on: September 25, 2024, 10:24:07 am »
Which should be fixed in version 3.4, shouldn't it?
Are you sure that Lazarus 3.4 came with a new(er) version of FPC ?  ;D

I am not sure it made fixes though (and I haven't seen fixes/trunk mentioned by TS).
Woops, yes, I meant FPC fixes (the TBufDataset is in FPC, not in Laz).

Last week I tried a new trunk (Laz+FPC) and that failed so I set my script back at fixes versions.
Code: Text  [Select][+][-]
  1. set fpc_version="fixes_3_2"
  2. set laz_version="fixes_3_2a"

That version gave me no problems.

Aren't those (fixes_3_2 and fixes_3_2a) not incorperated in the Lazarus 3.4 install (for both FPC and Lazarus) ???

The Lazarus team is glad to announce the release of Lazarus 3.4.

This is a bugfix release and was built with FPC 3.2.2.
Aaaaargh. So maybe they are not and FPC still has that problem with the standard install.
« Last Edit: September 25, 2024, 10:27:20 am by rvk »

egsuh

  • Hero Member
  • *****
  • Posts: 1614
Re: BufferDataset error Save and Load from file
« Reply #19 on: September 25, 2024, 10:44:05 am »
Quote
Can you compare the lfm (the part with the fields) with the original one?
I wonder why it would work after that.

(And what version of Lazarus?)

I don't see any difference between the two files, except that I've set the size of field MCode to 20, which is a ftMemo field (in the original file, it was 0). At first I had the same errors reported, and I set the size of MCode to 20, and the same errors.
Then I deleted and repopulated all the TFields. Then OK.

Lazarus version is 3.4.

rvk

  • Hero Member
  • *****
  • Posts: 6758
Re: BufferDataset error Save and Load from file
« Reply #20 on: September 25, 2024, 11:30:38 am »
Just tried standard 3.4 (my own compile went correctly but I'm not sure the revert to 3.2.2 went ok).

Standard Laz 3.4 with FPC 3.2.2 is indeed a mess with TBufDataset.

Just removing the MCode (and decoupling the TDBMemo) fixes the startup problems (without a DB present).

The error for exiting probably has to do with that mentioned issue.
BTW. After starting the application with an existing correct db, the exit works fine.

TRon

  • Hero Member
  • *****
  • Posts: 4377
Re: BufferDataset error Save and Load from file
« Reply #21 on: September 25, 2024, 02:11:15 pm »
Woops, yes, I meant FPC fixes (the TBufDataset is in FPC, not in Laz).
Thank you for the confirmation (my head is such a mess atm that I wasn't sure either).

Quote
Aren't those (fixes_3_2 and fixes_3_2a) not incorperated in the Lazarus 3.4 install (for both FPC and Lazarus) ???
Unfortunately, no.

That is why it is such a PITA that the release-cycle of FPC is (so) much slower (when compared to Lazarus).

Quote
Aaaaargh. So maybe they are not and FPC still has that problem with the standard install.
For sure. Therefor the only person able to shed a light is eldonfsr (until then I/we have to assume that (s)he is using a standard (non trunk/fixes) installation, no matter the version)

fwiw: It seems to be such a mess (either code-wise or in my head, not sure  :) ) that I do not know how to (correctly) work around the issue in TS' code.
Today is tomorrow's yesterday.

rvk

  • Hero Member
  • *****
  • Posts: 6758
Re: BufferDataset error Save and Load from file
« Reply #22 on: September 25, 2024, 02:44:55 pm »
fwiw: It seems to be such a mess (either code-wise or in my head, not sure  :) ) that I do not know how to (correctly) work around the issue in TS' code.
Yes, my advise would be to just get rid of the persistent fields (via the object inspector).
They aren't even used so just remove them. (only use FieldByName, NOT persistent defined fields.

But leave the FieldDefs in the TBufDataset (they are used for creation).

Move everything from FormShow to FormCreate (you don't want to be too late with creating the database).

Last... change the first MDBtns.Open to MDBtns.CreateDataset in Active=false part (just above the Append).

After that... everything should work fine (even in Lazarus 3.4).


TRon

  • Hero Member
  • *****
  • Posts: 4377
Re: BufferDataset error Save and Load from file
« Reply #23 on: September 26, 2024, 07:28:47 am »
After that... everything should work fine (even in Lazarus 3.4).
(Again) apologies for the delay.

Thank you very much for those detailed instructions rvk  8-)

That seems to work as intended.... with one small side-note: I needed to remove the existing db (from the original archive of TS) in order to prevent a streaming error on startup (which makes perfect sense).

In hind-side the suggested workaround makes perfect sense but this must be a PITA for those unfamiliar with bufdataset (which includes me as I hardly use this class/component)
Today is tomorrow's yesterday.

rvk

  • Hero Member
  • *****
  • Posts: 6758
Re: BufferDataset error Save and Load from file
« Reply #24 on: September 26, 2024, 11:26:19 am »
In hind-side the suggested workaround makes perfect sense but this must be a PITA for those unfamiliar with bufdataset (which includes me as I hardly use this class/component)
I do find it logical that you would need to do a CreateDataset (or likewise command). But I also normally don't used predefine FieldDefs in the object inspector. I much more prefer adding the FieldDefs in code and then a CreateDataset is more intuitive to create the dataset after defining the fields. And then there is no problem.

Luckily the problem with persistent fields is solved in the next version.
But I don't like using persistent fields anyway (as I do everything via code and FieldByName).


TRon

  • Hero Member
  • *****
  • Posts: 4377
Re: BufferDataset error Save and Load from file
« Reply #25 on: September 26, 2024, 11:36:39 am »
Amen to/for setting things up manually rvk.

Even though I started out designing databases with the visual designer (Delphi back then), once you have several forms/modules stuffed to the brim with database components then things become unmaintainable and is it much easier to manage manually (especially when you have the GUI and functional code separated).

Hopefully TS is (now) able to workaround the issue as well (thanks to your excellent instructions) but even better would be a new release of the compiler :)

Again, thank you very much for the guidance rvk.
Today is tomorrow's yesterday.

 

TinyPortal © 2005-2018