Commit Graph

1726 Commits

Author SHA1 Message Date
silverqx
1413ebb22a bump version to TinyORM v0.37.0 and tom v0.8.0
Also bumped to:

 - TinyUtils v0.4.0

Initial libraries' versions:

 - TinyDrivers v0.1.0
 - TinyMySql v0.1.0
2024-04-21 18:02:30 +02:00
silverqx
8394fc7625 added limit to logging string bind value to 1024 2024-04-10 17:20:29 +02:00
silverqx
dda0b9c2bb orm fixtypo in code 2024-04-10 17:20:29 +02:00
silverqx
473c17ea96 bugfix Qt5 builds 2024-04-10 17:20:29 +02:00
silverqx
9663e384f5 drivers used QVariant::typeId() everywhere
Because TinyDrivers only supports Qt6.

 - removed helpers_p.h
2024-04-07 18:12:07 +02:00
silverqx
42d8f3e3e6 drivers added exceptions mappings
To avoid #ifdef-s to have nice code.
2024-04-07 18:12:01 +02:00
silverqx
983af9a858 drivers removed TSqlError mappings
- also used the QSqlQuery directly where it makes sense
2024-04-07 18:12:01 +02:00
silverqx
712e4056a0 drivers updated comments 2024-04-07 18:12:01 +02:00
silverqx
039e9fcf4b drivers get rid of Drivers::SqlError 🔥🚀🥳
This is part 2 of: used TinyDrivers exceptions everywhere.
The Drivers::SqlError was dropped and renamed to DummySqlError which
does nothing and it exists only for API compatibility with QtSql module
and it also helps to avoid #ifdef-s in users/client code.

There are 3 exceptions (what is all this about) and they are SqlError,
QueryError, and SqlTransactionError. The SqlError is a general SQL
exception class that is thrown eg. during connecting to SQL server
or during all other SQL API calls that are not database queries or
transaction queries.

The second part of this commit was to modify all error handling
in TinyOrm library and adapt it to exceptions thrown from
the TinyDrivers library.
Many #ifdef-s were added because of this because QtSql module returns
bool and then you need to obtain the QSqlError and TinyDrivers library
throws exceptions.

This commit was huge, also it's very weird and this error handling
things are unpopular and everybody has different opinion on this, but
it is what it is.

There is not way I would return bool and set error state instead of
exceptions in TinyDrivers, never.
Also, there is no way I would catch Drivers::SqlError/QueryError/
SqlTransactionError in TinyOrm library and translate these TinyDrivers
exceptions to TinyOrm exceptions with the same names to throw only one
set of exceptions, no way. TinyDrivers throws its own exceptions and
TinyOrm linked against QtSql throws its own exceptions (with the same
names but in different namespace).

 - removed all setLastError() and throw exceptions instead
 - added new constants
 - optimized #include-s
 - changed the causedByLostConnection() method signature
 - enhanced the ManagesTransactions class
 - extracted code to the mysqlClose()
 - removed MySqlDriverPrivate::q_ptr (not needed anymore)
 - removed createError() and createStmtError() (not needed anymore) and
   added prepareMySqlError() and prepareStmtError() as counterparts
 - renamed method to errorMessageForStmtFetch()
 - extracted the replaceBindingsInSql() because it's used from both
   TinyOrm and TinyDrivers libraries
 - enhanced replaceBindingsInSql()
   - added support for BLOB-s
 - the SqlError, QueryError, and SqlTransactionError are excluded from
   TinyOrm library build and include path if compiled against
   the TinyDrivers library (they are not needed and used anymore)
 - added connection name to SqlResult class, it's used in exception
   messages
 - also updated auto tests

bugfix-es:

 - qmake propagate the TINYDRIVERS_MYSQL_DRIVER DEFINE (made it public),
   cmake build is OK
 - removed mysql_thread_init()
 - changed call order for the mysql_thread_end()
2024-04-07 18:12:00 +02:00
silverqx
247bb5e936 tom added TinyDrivers to tom about
- and also to the tom --version
 - added components to Dependencies section
 - prints info also about TinyMySql
 - takes into account all build types static/shared/loadable
 - tests both build systems qmake/CMake
2024-04-07 18:11:56 +02:00
silverqx
33bead847a drivers removed useless #error 2024-04-07 18:11:40 +02:00
silverqx
1e116969f1 drivers bugfix uncommented #include 2024-04-07 18:11:40 +02:00
silverqx
5bc60ef8b8 drivers revisited mapping #include-s 2024-04-07 18:11:39 +02:00
silverqx
097c6676c9 drivers added forward declaration macros
Added forward declaration macros for TClass-es.
2024-04-07 18:11:36 +02:00
silverqx
331ef5d013 drivers bugfix driver() vs driverWeak()
As the TinyDrivers library uses smart pointers everywhere it stores
the SqlDriver as std::shared_ptr<>/weak_ptr<> and because of this
we end up with API compatibility problems, exactly
the exposed SqlDriver *driver() method was problematic.

This commit solves this problem. The idea was to provide compatible API
related to this driver() method but also to still be able use smart
pointers internally.
2024-04-07 18:11:36 +02:00
silverqx
b6347ae229 drivers renamed enum types
Renamed from QSql::BeforeFirstRow/... and QSql::LowPrecisionDouble/...
to TCursorPosition and TPrecisionPolicy.
2024-04-07 18:11:36 +02:00
silverqx
28633c129e drivers renamed QSqlQuery to TSqlQuery 2024-04-07 18:11:36 +02:00
silverqx
1b470b817a drivers add swappable includes for SQL drivers
Added the TINY_INCLUDE_TSqlQuery macro for swappable #include-s between
Qt/Tiny SQL drivers. 👌
2024-04-07 18:11:35 +02:00
silverqx
cb7dd9fdcf drivers add swappable Qt/Tiny SQL drivers
The TinyOrm library can be compiled against the QtSql or TinyDrivers.
2024-04-07 18:11:35 +02:00
silverqx
59eedcfac3 drivers prepared for swappable Qt/Tiny SQL drivers
Added sqldrivermappings.hpp for swappable Qt/Tiny SQL drivers.
2024-04-07 18:11:35 +02:00
silverqx
007c275aa3 added and used TINYORM_PREPEND_NAMESPACE
It helped to avoid #ifdef-s for eg. Q_DECLARE_METATYPE or operator<<.
2024-04-07 18:11:34 +02:00
silverqx
018f9d70ee drivers initial qmake build 2024-04-07 18:11:34 +02:00
silverqx
e6266fb359 bugfix undeclared type in Release build 2024-04-07 16:45:34 +02:00
silverqx
dffdd8852c tom added completion for about --only= sections
Added support for pwsh, zsh, and bash shells.

Contains workaround for Register-ArgumentCompleter for array option
values, currently, the wordArg is empty, the workaround fix fills
the wordArg with the last option value.
2024-04-02 19:02:38 +02:00
silverqx
ae74599f37 bugfix missing defined() 2024-03-27 14:04:08 +01:00
silverqx
e8409accc1 used std::remove_cvref_t<> 2024-03-27 09:07:36 +01:00
silverqx
b3313a8475 orm updated comment 2024-03-26 21:03:07 +01:00
silverqx
fd6eba0436 unified all reserve()-s formatting 2024-03-26 21:03:06 +01:00
silverqx
3e45698224 unified all #if QT_VERSION >= QT_VERSION_CHECK(6)
Qt6 goes first.
2024-03-26 21:03:06 +01:00
silverqx
6fb271c53c whitespaces 2024-03-26 21:03:06 +01:00
silverqx
b3f35f9575 revisited static_cast<> for integral types 2024-03-26 21:03:05 +01:00
silverqx
f52bb9ebd5 orm removed useless static_cast<> 2024-03-26 21:03:04 +01:00
silverqx
efb98851a3 orm updated comment 2024-03-26 21:03:02 +01:00
silverqx
6ac9f2233a orm updated comment 2024-03-26 21:03:01 +01:00
silverqx
5a009e184f orm changed bool cast to ternary operator 2024-03-26 21:03:01 +01:00
silverqx
de0cfa1c77 used decltype ()::size_type everywhere 2024-03-26 21:03:00 +01:00
silverqx
0408cb0c6e added todo task 2024-03-26 21:03:00 +01:00
silverqx
69c1fda09d orm fixtypo 2024-03-26 21:02:56 +01:00
silverqx
86161d4079 revisited static_cast<> for integral types 2024-03-26 21:02:54 +01:00
silverqx
09911ffc6b revisited static_cast<> for integral types 2024-03-26 21:02:44 +01:00
silverqx
aa7d4baab4 orm fixtypo 2024-03-24 12:02:19 +01:00
silverqx
fffc7766e5 orm removed useless static_cast<> 2024-03-23 17:45:12 +01:00
silverqx
d67ab049d8 added MYSQL_OPT_SSL_MODE configuration support
- updated docs, tests, and workflows
2024-03-22 14:42:21 +01:00
silverqx
34f0535b26 reverted readability-redundant-member-init
Partially reverted, reverted for aggregate types because they must
contain this default initializer even if the type has the default
constructor.
2024-03-20 16:59:50 +01:00
silverqx
d69c1846e8 made methods static 2024-03-20 14:42:42 +01:00
silverqx
d1a513bc91 orm removed useless std::as_const() 2024-03-20 14:42:42 +01:00
silverqx
3ee66be289 orm updated comment 2024-03-20 14:42:42 +01:00
silverqx
7486b972e0 analyzers suppressed Clang Tidy warning
- updated comment
2024-03-20 14:42:42 +01:00
silverqx
9f4a7ec155 whitespaces 2024-03-20 14:42:41 +01:00
silverqx
780c81ef15 analyzers fixed/suppressed Clang Tidy warning
Suppressed for exception tag classes.

 - cppcoreguidelines-special-member-functions
2024-03-20 14:42:41 +01:00