Recent

Author Topic: DB Navigator - how to get the "commit" in work  (Read 1077 times)

Nicole

  • Hero Member
  • *****
  • Posts: 990
DB Navigator - how to get the "commit" in work
« on: May 08, 2024, 08:05:24 pm »
Here is a strange thing and I am not sure, why it is not working.
I use this way of doing it in several cases and do not have any issue like this

The problem is:
- I change something by using the DBNavigator
- the change works
- but it seems not to "commit"

pls see screenshot for my example

Which parameter may be wrong?
Thanks.


af0815

  • Hero Member
  • *****
  • Posts: 1330
Re: DB Navigator - how to get the "commit" in work
« Reply #1 on: May 08, 2024, 10:05:06 pm »
Autocommit activated ?
regards
Andreas

datiscum

  • New member
  • *
  • Posts: 8
Re: DB Navigator - how to get the "commit" in work
« Reply #2 on: May 09, 2024, 09:50:53 am »
To think for yourself.
In the component under "VisibleButtons" they are all listed by name.
Where does it say anything about "commit"?

Implicitly, a Post button can become a Commit button if AutoCommit is switched on.

Nicole

  • Hero Member
  • *****
  • Posts: 990
Re: DB Navigator - how to get the "commit" in work
« Reply #3 on: May 09, 2024, 10:43:13 am »
Autocommit has only 2 options an is set to
acCommitRetaining

Yes, the "post"-button is is, which usually works for me as "commit". No idea, why not in this case. Something is wrong. Usually it turns to green, if there is something pending. Not in this case. It stays grey and is not in function.
« Last Edit: May 09, 2024, 10:45:19 am by Nicole »

datiscum

  • New member
  • *
  • Posts: 8
Re: DB Navigator - how to get the "commit" in work
« Reply #4 on: May 09, 2024, 01:33:35 pm »
I like to use a sql monitor component to see exactly what the database components are doing. To test where the problem really lies, simply create a TButton that can only be pressed when the transaction is "Active".  If it is still active after the post, the transaction is still active and not committed. This is then your correct button to safely trigger a commit. The problem should then be narrowed down. Otherwise you can't find the problem without the code.

It doesn't matter whether AutoCommit is set to Retaining or not, you only do this so that your datasets are not closed.

egsuh

  • Hero Member
  • *****
  • Posts: 1394
Re: DB Navigator - how to get the "commit" in work
« Reply #5 on: May 10, 2024, 09:04:47 am »
I'm trying to replicate your issue, but it was not easy. It says "updates must be applied before refresh" or "the dataset cannot be opened".  I finally succeeded to do that after adding following event handler.

Code: Pascal  [Select][+][-]
  1. procedure TfrFirebird.SQLQuery1BeforeRefresh(DataSet: TDataSet);
  2. begin
  3.    SQLQuery1.ApplyUpdates;
  4.    SQLQuery1.Close;
  5.    SQLQuery1.Open;
  6. end;
  7.  

Transaction and Post are different. "Post" is done at local TDataSet level. At the TDataSet level, if you delete a record or change a field and move to other record, the changes are "post"ed automatically. The refresh button will remain green when you edit a cell, and move only within the same record.

Transaction takes care of modifying the contents (Insert, Delete, Update) of the server database table --- it must be related with "ApplyUpdates".




 

TinyPortal © 2005-2018