Kexi: Do not switch to Data View if fetching records failed, show clear message

Authored by staniek.

Description

Kexi: Do not switch to Data View if fetching records failed, show clear message

Summary:
In particular this covers the cases:

  • reserved word used for table name (we're not supporting it in Kexi 2.x, see bug 356888 and example attached there)
  • reserved word used for field name (we're not supporting it in Kexi 2.x, see bug 357025 and example attached there)
  • any data fetching errors
  • all the above is supported not only for tables (as the bug report suggests) but also for queries, forms, reports, csv export
  • a few API changes were required for reports

Also display better error message; in addition to "Opening object "cast" failed. Switching to other view failed (Data View)." this is displayed in the details (examples):

  • "Error opening database cursor. near ".": syntax error"
  • exact SQL statement

BUG:356888
FIXED-IN:2.9.11

Test Plan:
Open the 356888-Test01.kexi file attached at https://bugs.kde.org/show_bug.cgi?id=356888#attach_96375 and test the following:

  • open the 'cast' table in data view mode
  • open the 'cast' query in data view mode
  • open the 'cast' form in data view mode
  • open the 'cast' report in data view mode
  • right-click the 'cast' table and pick Export -> To Clipboard
  • right-click the 'cast' table and pick Export -> To File...

In all these cases error like this should appear:
"Opening object "cast" failed. Switching to other view failed (Data View)
Error opening database cursor. near ".": syntax error
SQL statement: SELECT movies_id, person_id, id, cast.OID FROM cast ORDER BY id"

And Kexi should refuse opening the data view.

Also opeining any of these objects in design view works. Then Kexi should not allow to switch to data view, displaying the same error.

Reviewers: piggz

Subscribers: Kexi-Devel-list

Differential Revision: https://phabricator.kde.org/D726

Details