Bug 117513 - Firebird: DATALOSS Data updated (new/edit) using the data Beamer window or Dataform in odt/ods file is lost when odt/ods file is closed.
Summary: Firebird: DATALOSS Data updated (new/edit) using the data Beamer window or Da...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
6.1.0.0.alpha1+
Hardware: All All
: high major
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 124843 (view as bug list)
Depends on:
Blocks: Database-Firebird-Default
  Show dependency treegraph
 
Reported: 2018-05-08 19:24 UTC by Drew Jensen
Modified: 2024-02-02 15:32 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
test file (converted to firebird sdbc) (13.46 KB, application/vnd.oasis.opendocument.database)
2018-05-08 19:25 UTC, Drew Jensen
Details
Unzip the file, register database for Firebird as "Beispiel_Sport" and add data in form. (70.85 KB, application/zip)
2021-07-13 06:23 UTC, Robert Großkopf
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Drew Jensen 2018-05-08 19:24:00 UTC
Description:
Base when using the embedded firebird data engine does not write data to the disk until the user executes a file save. 

When a registered database using the firebird sdbc is opened in the beamer window (writer or calc) and data is entered into a table there is no way for the user to save the database (odb) file from that UI. The data entered will be lost when the file you are working on closes.

Steps to Reproduce:
1. Download and open the attached firebird ODB file
2. open Tools|Options|Base|Databases 
3. click on new and register the downloaded file.
4. Create a new Calc or Writer file
5. Open the beamer window (View|Data Sources) 
6. double click on the newly registered database name from above
7. open the Tables entry and double click on the first table. (tbl_text_varchar)
8. A table grid displays to the right, in the beamer and shows it is ready to enter new records.
9. Enter a value in tst_data field for a new record.
10. Close the Calc or Writer file 
11. Open the database file.
12. Open table tbl_text_varchar

Actual Results:  
The record you entered, and thought you saved, in the beamer is gone.

Expected Results:
Record was retained in database table.


Reproducible: Always


User Profile Reset: No



Additional Info:
Tested on:
Version: 6.1.0.0.alpha1+
Build ID: ecf50fe71596c3edba8ce437481ab80ae1cd8935
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk2; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2018-05-08_00:13:13
Locale: en-US (en_US.UTF-8); Calc: group


User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/65.0.3325.181 Chrome/65.0.3325.181 Safari/537.36
Comment 1 Drew Jensen 2018-05-08 19:25:07 UTC
Created attachment 141987 [details]
test file (converted to firebird sdbc)

Test firebird sdbc file
Comment 2 Robert Großkopf 2018-05-09 05:56:55 UTC
You are right. 
It is the same behavior when writing data in the table. The Save-button will be disabled after changing row - looks all pretty. Then you could close your document. When you use the databrowser in Writer or Calc there won't be any dialog for asking: Do you want to save your data. There is no possibility to save the data.

Again: We should save data automatically: bug 117118.

But this is set to enhancement ...
Comment 3 Lionel Elie Mamane 2018-05-09 13:13:36 UTC
This scenario is indeed problematic. Tamas, any thoughts?
Comment 4 Drew Jensen 2019-04-19 18:11:17 UTC
*** Bug 124843 has been marked as a duplicate of this bug. ***
Comment 5 Drew Jensen 2019-04-19 18:32:06 UTC
(In reply to Drew Jensen from comment #4)
> *** Bug 124843 has been marked as a duplicate of this bug. ***

I think the solution is fairly straight forward.
Move the event where the firebird database is written to disc from out of the file save function into the connection close function. 

How much that would take to move IDK but I'd bet dimes to euros that it would fix it and fix this new dup issue which is not about the beamer but about external forms (dataforms embedded in odt/ods/etc files), which act just as the beamer does.

So; one thing. If you open the ODB before you close the file the external dataform is in (beamer or doc.drawpage.forms) the update data is visible in the ODB table, and if still open after you close the odt/ods the data is not lost. You just have to save the ODB file to make it stick.
Comment 6 QA Administrators 2021-04-19 03:39:32 UTC Comment hidden (obsolete)
Comment 7 Robert Großkopf 2021-04-19 05:21:01 UTC
Nothing has been changed her. Bug is almost the same in LO 7.1.2.2 on OpenSUSE 15.2 64bit rpm Linux.
Comment 8 Robert Großkopf 2021-07-13 06:23:10 UTC
Created attachment 173520 [details]
Unzip the file, register database for Firebird as "Beispiel_Sport" and add data in form.

Would be the same reason.

Open the attached *.zip. Unpack it.
Register database "Beispiel_Sport_Firebird.odb" as "Beispiel_Sport".
Start the external form.
Change data. When switching from on row to another data seem to be changed.
Close the form and LO.
Reopen LO and the form.
Data won't be saved.

You have to open the database before you close LO.
Then you have to save the database.

So external forms won't work with Firebird.
Comment 9 jcsanz 2023-03-06 22:35:24 UTC
I've sent a patch https://gerrit.libreoffice.org/c/core/+/148368 I think solves this problem. Just in case somebody want to test it
Comment 10 jcsanz 2023-04-24 15:15:25 UTC
My patch to tdf#117118 has been pushed to "master" (https://git.libreoffice.org/core/commit/9227fbabe0a33134f56aefdd8ec16024f006a659) and it solves also this bug, just case somebody want to test the fix and report feedback.
Comment 11 jcsanz 2023-09-20 21:47:16 UTC
I've reverted the path, because generates a new bug, until further investigation
Comment 12 Robert Großkopf 2024-01-29 09:39:19 UTC
This is a bug with dataloss (high importance). Nothing new happens.

I solved it by setting

SUB DataSave(oEvent AS OBJECT)
 oEvent.Source.activeConnection.Parent.flush
END SUB

after any record action of external form.

Isn't this also possible to write something like this directly in code of LO?
Comment 13 jcsanz 2024-01-29 17:58:51 UTC
I added a new patch which solves the previous patch malfunction, but it is waiting for revision or comment for more than two months...
Comment 14 Robert Großkopf 2024-02-02 15:32:01 UTC
Solved with fix for Bug 117118.

Could input data.
Could go to next row.
Could change data.
Could close the form (irritating Writer-warning Document has been changed…).

When opening the database all data will be saved.