Before physical altering or deleting table ask the user to close depending table/query/report/form
ClosedPublic

Authored by staniek on Oct 2 2017, 8:46 PM.

Details

Summary

If table T is altered, before saving:

  • close all table views that use T in lookup fields
  • close all query views that use T
  • close all query views that use tables having T in lookup fields
  • close all tables that use queries in lookup fields and the queries use T

Similarly, close all forms/reports that use tables this way.
Any views are affected (data, design, text).

Also:

  • improve existing question messages
  • remove Report's extended data source GUI

BUG:371896
FIXED-IN:3.1.0

Test Plan

Use the test Kexi file (uncompress before testing):

Test 1.1: If table T is altered, before saving close all table views that use T in lookup fields.

  1. Open ownership table in data view.
  2. Design the persons table, rename the last (Extra) field to something else, save design.
  3. Expected: Kexi asks to close the ownership table. On agreement, they are closed and the design is saved.

Test 1.2. Like 1.1 but open ownership table in design view.
Expected result: like in 1.1.

Test 2.1. If table T is altered, before saving close all query views that use T.

  1. Open persons_and_cars query in data view.
  2. Design the persons table, rename the last field to something else, save design.
  3. Expected: Kexi asks to close the persons_and_cars query. On agreement, they are closed and the design is saved.

Test 2.2. Like 2.1 but open the query in design view.
Expected result: like in 2.1.

Test 2.3. Like 2.1 but open the query in SQL view.
Expected result: like in 2.1.

Test 2.4. Like 2.1 but also open the ownership table after 2nd step.
Expected result: Kexi asks to close both the ownership table and the persons_and_cars query. On agreement, they are closed and the design is saved.

Test 2.5. Like 2.4 but also open the persons form before saving.
Expected result: Kexi asks to close both the ownership table and the persons_and_cars query and the persons form. On agreement, they are closed and the design is saved.

Test 2.6. Like 2.5 but also open the persons report before saving.
Expected result: Kexi asks to close both the ownership table and the persons_and_cars query and the persons form and the persons report. On agreement, they are closed and the design is saved.

Test 3.1. If table T is altered, before saving close all query views that use tables having T in lookup fields.

  1. Open ownership_desc query in data view.
  2. Design the persons table, rename the last field to something else, save design.
  3. Expected: Kexi asks to close the ownership_desc query. On agreement, they are closed and the design is saved.

Test 3.2. Like 2.1 but open the table in design view.
Expected result: like in 3.1.

Test 4.1. If table T is altered, before saving close all tables that use queries in lookup fields if these queries use T.

  1. Open with_lookup_query table in data view.
  2. Design the persons table, rename the last field to something else, save design.
  3. Expected: Kexi asks to close the with_lookup_query query. On agreement, they are closed and the design is saved.

Test 4.2. Like 4.1 but open the table in design view.
Expected result: like in 4.1.

Test 5.1. Testing if Kexi detects dependency between report cars and designed table cars because the report uses query that uses the table.

  1. Open report cars in preview.
  2. Design the cars table, rename and field, try to save design (finally don't save unless you have backup of the database).
  3. Expected: Kexi asks to close the report cars.

Test 6.1. Improve existing question messages asking for approval for closing depending tabs: see if they sound are correct and look OK.

Example:

Test 7.1. (Extra test of functionality that was hard to separate to another patch). Updated "Report data source" page (removed Set button and the External data widgets). Test if setting table and query as data source works.

Diff Detail

Repository
R71 Kexi
Branch
arcpatch-D8118
Lint
No Linters Available
Unit
No Unit Test Coverage
staniek created this revision.Oct 2 2017, 8:46 PM
Restricted Application added a project: KEXI. · View Herald TranscriptOct 2 2017, 8:46 PM
staniek edited the test plan for this revision. (Show Details)Oct 2 2017, 9:15 PM
staniek edited the test plan for this revision. (Show Details)Oct 2 2017, 9:24 PM
staniek edited the test plan for this revision. (Show Details)Oct 2 2017, 9:27 PM
staniek edited the test plan for this revision. (Show Details)
staniek updated this revision to Diff 20379.Oct 5 2017, 8:23 PM
staniek edited the test plan for this revision. (Show Details)

Update for master

staniek updated this revision to Diff 21738.Nov 1 2017, 10:18 PM
  • Merge branch 'master' into arcpatch-D8118
  • GIT_SILENT KexiFormView: update for the KProperty::ValueOption API change
piggz added a comment.Nov 1 2017, 11:32 PM

Got following crash, when renaming the same field twice

Thread 1 "kexi-3.1" received signal SIGSEGV, Segmentation fault.
0x00007ffff6e0fefa in QHash<KDbField const*, KDbLookupFieldSchema*>::isEmpty (this=0x52) at /usr/include/qt5/QtCore/qhash.h:269
269 inline bool isEmpty() const { return d->size == 0; }
(gdb) bt
#0 0x00007ffff6e0fefa in QHash<KDbField const*, KDbLookupFieldSchema*>::isEmpty (this=0x52) at /usr/include/qt5/QtCore/qhash.h:269
#1 0x00007ffff6e0efb9 in KDbTableSchema::lookupFields (this=0xdd7b20) at /home/piggz/src/kdb/src/KDbTableSchema.cpp:408
#2 0x00007ffff6e138ea in KDbTableSchemaChangeListenerPrivate::tableDependsOnTable (checkedTables=0x7fffffffc210, checkedQueries=0x7fffffffc208, conn=0x8280c0, table1=0xdd7b20, table2=0x7cb3a0)

at /home/piggz/src/kdb/src/KDbTableSchemaChangeListener.cpp:144

#3 0x00007ffff6e143ae in KDbTableSchemaChangeListenerPrivate::collectListeners (result=0x7fffffffc270, conn=0x8280c0, table=0x7cb3a0) at /home/piggz/src/kdb/src/KDbTableSchemaChangeListener.cpp:284
#4 0x00007ffff6e12aec in KDbTableSchemaChangeListener::listeners (conn=0x8280c0, table=0x7cb3a0) at /home/piggz/src/kdb/src/KDbTableSchemaChangeListener.cpp:506
#5 0x00007fffce6499e3 in KexiTablePart::askForClosingObjectsUsingTableSchema (window=0xdd2eb0, conn=0x8280c0, table=0x7cb3a0, msg=...) at /home/piggz/src/kexi/src/plugins/tables/kexitablepart.cpp:189
#6 0x00007fffce658cc1 in KexiTableDesignerView::storeData (this=0xea37a0, dontAsk=false) at /home/piggz/src/kexi/src/plugins/tables/kexitabledesignerview.cpp:1431
#7 0x00007ffff77fe7ec in KexiWindow::storeData (this=0xdd2eb0, dontAsk=false) at /home/piggz/src/kexi/src/core/KexiWindow.cpp:753
#8 0x00007ffff7abe027 in KexiMainWindow::saveObject (this=0x6df850, window=0xdd2eb0, messageWhenAskingForName=..., options=...) at /home/piggz/src/kexi/src/main/KexiMainWindow.cpp:2868
#9 0x00007ffff7abc880 in KexiMainWindow::slotProjectSave (this=0x6df850) at /home/piggz/src/kexi/src/main/KexiMainWindow.cpp:2549
#10 0x00007ffff7b1ed05 in KexiMainWindow::qt_static_metacall (_o=0x6df850, _c=QMetaObject::InvokeMetaMethod, _id=67, _a=0x7fffffffcad0) at /home/piggz/src/kexi-build/src/main/keximain_autogen/EWIEGA46WW/moc_KexiMainWindow.cpp:701
#11 0x00007ffff293663a in QMetaObject::activate(QObject*, int, int, void) () from /usr/lib64/libQt5Core.so.5
#12 0x00007ffff3fcc982 in QAction::triggered(bool) () from /usr/lib64/libQt5Widgets.so.5
#13 0x00007ffff3fcee1c in QAction::activate(QAction::ActionEvent) () from /usr/lib64/libQt5Widgets.so.5
#14 0x00007ffff3fcf35f in ?? () from /usr/lib64/libQt5Widgets.so.5
#15 0x00007ffff293663a in QMetaObject::activate(QObject*, int, int, void
) () from /usr/lib64/libQt5Core.so.5
#16 0x00007ffff40bd412 in QAbstractButton::clicked(bool) () from /usr/lib64/libQt5Widgets.so.5
#17 0x00007ffff40bd5fa in ?? () from /usr/lib64/libQt5Widgets.so.5
#18 0x00007ffff40be91a in ?? () from /usr/lib64/libQt5Widgets.so.5
#19 0x00007ffff40beae4 in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib64/libQt5Widgets.so.5
#20 0x00007ffff4191efa in QToolButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib64/libQt5Widgets.so.5
#21 0x00007ffff400e7a8 in QWidget::event(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#22 0x00007ffff4191f84 in QToolButton::event(QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#23 0x00007ffff3fd2afc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#24 0x00007ffff3fda40f in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#25 0x00007ffff2909128 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#26 0x00007ffff3fd945f in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib64/libQt5Widgets.so.5
#27 0x00007ffff4028a1b in ?? () from /usr/lib64/libQt5Widgets.so.5
#28 0x00007ffff402ae71 in ?? () from /usr/lib64/libQt5Widgets.so.5
#29 0x00007ffff3fd2afc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#30 0x00007ffff3fd9eb4 in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#31 0x00007ffff2909128 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#32 0x00007ffff3161dbb in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib64/libQt5Gui.so.5
#33 0x00007ffff3163705 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib64/libQt5Gui.so.5
#34 0x00007ffff313cf9b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Gui.so.5
#35 0x00007fffe35f9420 in ?? () from /usr/lib64/libQt5XcbQpa.so.5
#36 0x00007fffebd65f97 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#37 0x00007fffebd661d0 in ?? () from /usr/lib64/libglib-2.0.so.0
#38 0x00007fffebd6625c in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#39 0x00007ffff295f23f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#40 0x00007ffff290773a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQt5Core.so.5
#41 0x00007ffff290ffc4 in QCoreApplication::exec() () from /usr/lib64/libQt5Core.so.5
#42 0x0000000000400f72 in main (argc=2, argv=0x7fffffffd9f8) at /home/piggz/src/kexi/src/main.cpp:36

src/plugins/tables/kexitabledesignerview.cpp
1430

but the following....are open:

staniek updated this revision to Diff 21816.Nov 2 2017, 11:07 PM
  • Merge branch 'master' into arcpatch-D8118
staniek updated this revision to Diff 21818.Nov 3 2017, 12:24 AM
  • TRIVIAL: spelling "but the following....are open"
staniek marked an inline comment as done.Nov 3 2017, 12:25 AM
piggz accepted this revision.Jan 2 2018, 8:31 PM
This revision is now accepted and ready to land.Jan 2 2018, 8:31 PM
staniek updated this revision to Diff 24862.Jan 7 2018, 12:39 AM

Merge

  • GIT_SILENT KexiFormView: update for the KProperty::ValueOption API change
  • TRIVIAL: spelling "but the following....are open"
This revision was automatically updated to reflect the committed changes.
In D8118#163183, @piggz wrote:

Got following crash, when renaming the same field twice

Crashes for me in a simple one-column table without lookup columns too :(