API: Make query and table objects independent of connection (decouple)
So far table and query schema objects had connection pointer attached to them. There are issues with that:
- the connetion pointer was not always present (depends on constructor)
- connection needs to be created/accessible first, then the table/schema objects can be created
- lifetime problem: by closing the connection there can be hanging pointers to the connection
This patch changes very little of functionality, mostly the API is altered. Connection pointer is now supplied when needed (eg. KDbQuerySchema::field, KDbQuerySchema::columnInfo). Query objects now cache their column information in context of connection. As soon as connection object changes, the cache is updated on next access.
Changes less related to the main topic but affecting the same classes are added:
+ use enum class instead of enums
+ because connection context is needed for query or table, QDebug operator now needs it too so std::tuple is used
+ move recordCount() to KDbConnection
+ fix parser when query object is pre-allocated
+ cache expanded fields of KDbQuerySchema in context of connection
+ side effect: the expanded field cache now uses less pointers so many checks for null pointers and and operator-new calls have been removed from KDbQuerySchema
+ add QuerySchemaTest: test if expanded fields cache is updated when query schema object changes
+ add more const overloads
Run all autotests, run Kexi - try tables/queries/forms/reports in data and design view.
Check if scripts work.
Reviewed By: piggz
Maniphest Tasks: T6695
Differential Revision: https://phabricator.kde.org/D7027