Commit Graph

473 Commits

Author SHA1 Message Date
silverqx
873affcd2b fixed macro guard names 2022-01-03 13:11:22 +01:00
silverqx
657f39b104 moved SyncChanges to Tiny::Types 2022-01-03 13:11:01 +01:00
silverqx
29460a3ff3 fixed dtor declaration position 2022-01-03 12:12:51 +01:00
silverqx
a61b9bc3f1 bugfix namespace related
- missing TINYORM_BEGIN_COMMON_NAMESPACE
 - forgotten update of macro guard name
2022-01-03 12:11:54 +01:00
silverqx
19a7b4d1fd disabled thread_local for Clang on Linux 🤯 2022-01-02 16:58:35 +01:00
silverqx
c30cfb5f3b bugfix gcc linux, threadlocal macro condition 2022-01-02 16:24:35 +01:00
silverqx
d750d0ab0e removed todo task 2022-01-01 19:18:35 +01:00
silverqx
449e171d20 bugfix missing QtGlobal include 2022-01-01 19:18:05 +01:00
silverqx
087bf68999 moved LOG_EXECUTED_QUERY macro to own file 2022-01-01 16:31:59 +01:00
silverqx
92775f444c divided Orm::Utils
While ORM can be disabled, Orm::Utils has been split into Orm::Utils
and Orm::Tiny::Utils (Orm::Tiny::TinyUtils alias).
So when ORM is disabled then utils used only in the ORM will be
excluded from a final build.

 - bugfix cmake undefined ORM option in TinySources
2022-01-01 14:28:42 +01:00
silverqx
fc477bf1e5 added qmake/cmake option to disable ORM
Added TINYORM_DISABLE_ORM macro controlled by ORM for CMake and
disable_orm for qmake. When TINYORM_DISABLE_ORM macro is defined then
only the query builder without ORM is compiled.
Also excludes ORM-related unit tests.
2021-12-31 11:40:12 +01:00
silverqx
869362bc7a added DISABLE_THREAD_LOCAL macro
Overrides default detection logic for thread_local and disable it
forcefully.
In qmake can be configured by "CONFIG+=disable_thread_local".
For Cmake DISABLE_THREAD_LOCAL option was added.
2021-12-30 17:12:29 +01:00
silverqx
d50b00e614 added todo task 2021-12-28 19:31:58 +01:00
silverqx
08791883ec disabled thread_local for Clang 13 on Linux
Started crashing again on Linux with Clang 13 and Qt 6.2.2, Qt 5.15.2 is
fine.
2021-12-28 19:23:32 +01:00
silverqx
7ab116c826 added todo tasks 2021-12-27 16:53:15 +01:00
silverqx
d05a89942c removed todo task 2021-12-09 17:41:06 +01:00
silverqx
516968c7d1 bugfix docs many-to-many custom pivot example 2021-12-09 14:53:21 +01:00
silverqx
5172247699 removed todo task 2021-12-08 15:39:20 +01:00
silverqx
4429f875ca explicit typecast from char[] to const char * 2021-12-08 12:27:37 +01:00
silverqx
acfb83d473 bugfix undefined RuntimeError 2021-12-08 12:27:36 +01:00
silverqx
371bfad628 used std::unique_ptr with abi::__cxa_demangle() 2021-12-08 12:27:36 +01:00
silverqx
8d744057b5 fixed clang-tidy diagnostics on Linux 2021-12-08 12:27:36 +01:00
silverqx
9aee6d4bed fixed clang-tidy diagnostics 2021-12-08 12:27:35 +01:00
silverqx
09592a7732 added GitHub Actions Linux, MSYS2 UCRT64, MSVC
- initial g++/clang build, ctest on MSYS2 UCRT64 on Windows Server 2022
 - initial cmake build/ctest on Ubuntu 20.40
 - initial cmake build/ctest on MSVC on Windows Server 2019

changed driver to QPSQL in tst_databasemanager

This avoids crash when QMYSQL driver's dll is unavailable.
QMYSQL driver is not shipped by default by Qt Windows MSVC installer.
2021-12-08 12:27:25 +01:00
silverqx
424f32498d added todo task 2021-11-22 22:01:57 +01:00
silverqx
9972989505 removed todo task 2021-11-22 20:32:45 +01:00
silverqx
285dbf51c9 enabled TLS for clang >=13
TLS wrapper started working correctly on Clang 13 for Linux, so enabled
multi-threading support.
2021-11-22 19:51:10 +01:00
silverqx
09e2a56275 removed todo tasks 2021-11-21 21:25:35 +01:00
silverqx
dcbb113fc8 added Fs::resolveHome()
It resolves ~ home prefix to the full filepath
2021-11-21 19:30:51 +01:00
silverqx
92dd1e333e whitespaces 2021-11-18 14:35:50 +01:00
silverqx
52333fd777 bugfix missing pragma once 2021-11-18 14:35:42 +01:00
silverqx
fe333e43d6 bugfix Model::u_dates 2021-11-16 19:31:18 +01:00
silverqx
037207cd42 moved DatabaseConfiguration to support/ 2021-11-13 19:09:15 +01:00
silverqx
de21f6d4c5 removed todo tasks 2021-11-13 15:11:03 +01:00
silverqx
1df00a3caf prettified section names in DB/DM/DC 2021-11-13 15:10:15 +01:00
silverqx
82bcdc2623 made all defaulted methods explicitly inline 2021-11-13 15:08:20 +01:00
silverqx
06e3f62bd8 unified inherit constructors 2021-11-13 14:15:39 +01:00
silverqx
e56a28c1bf docs added Pivot include to doc examples 2021-11-13 14:09:38 +01:00
silverqx
8997c6128c removed pivot include at model.hpp end
Removed long issue which I could not get rid of, now Pivot is only
header only, is not dll exported and that was the core of whole problem.
2021-11-13 11:21:52 +01:00
silverqx
86c6398977 added Pivot::u_guarded TLS
Now, when Pivot doesn't have dll export can be explicit about u_guarded
and also can add the TLS wrapper.
2021-11-13 11:19:24 +01:00
silverqx
fe371d9fbd removed SHAREDLIB_EXPORT from header files only 2021-11-13 11:12:50 +01:00
silverqx
907f092ad8 added NEWLINE to constants 2021-11-13 08:47:12 +01:00
silverqx
57da4a109e renamed macros.hpp to likely.hpp
It contained T_LIKELY/T_UNLIKELY only.
2021-11-12 20:40:02 +01:00
silverqx
3dcb5b768a added todo task 2021-11-12 18:20:03 +01:00
silverqx
76c938f546 removed system header from PCH
It generates warning on mingw and I'm using -i system anyway.
2021-11-12 18:19:54 +01:00
silverqx
b37c71504e bugfix in system header macro
Clang masquerades as GCC 4.2.0 so it has to be first.
2021-11-12 18:19:18 +01:00
silverqx
e989407229 final condition for T_THREAD_LOCAL
Database connections in threads is supported on:

 - Linux gcc all linkers
 - MinGW clang lld linker only
 - MSVC (is king anyway 😎)

All other variants cause different compiler errors or runtime crashes.
2021-11-12 16:10:47 +01:00
silverqx
b39b4dcf48 fixed errors for Linux clang/gcc 2021-11-12 12:27:03 +01:00
silverqx
272d27043c database connections in threads support 🔥🚀
Database connection can run in a thread, if you create a connection in
a thread, then you have to use it only from that thread, moving it to
another thread is disallowed.
All restrictions for QSqlDatabase are true also for TinyORM.
The most important work was in DatabaseManager because more threads can
access it at once.
DatabaseManager has to be created only once in the whole application,
so it means when it will be created in a non-main thread, then it has
to be used from this non-main thread the whole time, I didn't try it
to move to another thread, the conclusion is that DatabaseManager can be
created and used from a worker thread.

 - refactored db configuration
 - added DatabaseConnectionsMap to outsource ConnectionsType and make it
   thread_local
 - added resetDefaultConnection()
 - m_queryLogId is atomic
 - made all class static data members thread_local

Thread unrelated:
 - added two new addConnections() overloads
 - added Thread utils class
   - added NameThreadForDebugging()
 - enhanced tst_DatabaseManager
2021-11-12 09:54:28 +01:00
silverqx
7f3c81de7e added thread_local for all static variables 2021-10-30 19:21:02 +02:00