Commit Graph

790 Commits

Author SHA1 Message Date
silverqx 5e957cc700 qmake added comment 2023-09-09 09:13:33 +02:00
silverqx 26a6c17587 qmake updated conf.pri error messages
- also formatting
2023-09-09 09:13:32 +02:00
silverqx ffd3817380 enhanced Helpers::logException()
Log the QLibraryInfo::PluginsPath if an exception message contains:
QSqlError(Driver not loaded, Driver not loaded).
2023-09-09 09:13:32 +02:00
silverqx 54dee94e91 qmake bugfix tiny_autoconf
Throw conf.pri error only if the tiny_autoconf is disabled.

 - also moved the User Configuration to the bottom, as the last thing
2023-08-18 17:52:42 +02:00
silverqx 1c1beb990f qmake removed vcpkgconf.pri
It was used in the vcpkg port file to build the TinyORM using qmake
build system, it's not used anymore as the CMake build is used instead.
2023-08-11 18:42:33 +02:00
silverqx 46da62de53 qmake added comment 2023-08-11 18:42:32 +02:00
silverqx d0d4e2b628 qmake added tiny_autoconf feature
The tiny_autoconf and tiny_dotenv qmake CONFIG were added in the TinyORM
v0.34.0. These new features allow to auto-configure TinyORM, and with
their help, the conf.pri files can be skipped entirely. The
tiny_autoconf is designed to find the vcpkg installation and tiny_dotenv
to include the .env and .env.$$QMAKE_PLATFORM files in the project's
root folder. They can be configured using qmake and environment
variables, and they also contain some guessing logic if these variables
are not defined.

These are qmake and environment variables that affect the
auto-configuration feature:

- TINY_VCPKG_ROOT - path to the vcpkg installation folder (if not
  defined then it tries to use the VCPKG_ROOT environment variable)
- TINY_VCPKG_TRIPLET - vcpkg triplet to use
  (vcpkg/installed/$$TINY_VCPKG_TRIPLET/); if not defined then it tries
  to guess the vcpkg triplet on the base of the current compiler and OS
  (QMAKESPEC)
- TINY_MYSQL_ROOT - path to the MySQL installation folder (if not
  defined then it tries to guess the MySQL installation folder:
  $$(ProgramFiles)/MySQL/MySQL Server (8.1|8.0|5.7)/)

You can set these variables in the .env or .conf files (recommended), in
the qmake file (or wherever you want), or as environment variables.

These variables are set after the auto-configuration is done:

- TINY_VCPKG_INCLUDE - path to vcpkg include folder
  (vcpkg/installed/<triplet>/include/)
- TINY_MYSQL_INCLUDE - path to the MySQL include folder (MySQL Server
  8.1/include/)
- TINY_MYSQL_LIB - path to the MySQL lib folder (MySQL Server
  8.1/include/)

The TINY_MYSQL_INCLUDE and TINY_MYSQL_LIB are only set on win32 except
mingw.
2023-08-09 20:34:18 +02:00
silverqx 963f302539 qmake enhanced formatting 2023-08-02 18:53:10 +02:00
silverqx 31453c32db qmake updated error message
- used the $$TARGET instead of a hardcoded target
2023-08-02 18:53:09 +02:00
silverqx 017c47f7ac qmake/cmake updated comment 2023-08-02 18:53:09 +02:00
silverqx 69fd718296 cache the MySQL version
To avoid database queries.

 - also added a database version check for empty version value
2023-08-02 18:21:21 +02:00
silverqx 8b9c57b127 fixed deprecated MYSQL_OPT_RECONNECT warning
The MYSQL_OPT_RECONNECT option is deprecated from MySQL >=8.1 and
>=8.0.24, so don't use it.

 - updated exception message
2023-08-02 18:19:45 +02:00
silverqx 217128a12d removed useless likely and unlikely attributes 2023-07-24 16:25:49 +02:00
silverqx 107f77b965 added StringUtils::stripTags() 2023-07-24 16:25:48 +02:00
silverqx 6080fc616b enhanced StringUtils::snake()
- avoid underscores at the beginning and end
 - make snake also for spaces
2023-07-24 16:25:48 +02:00
silverqx bac423b249 removed reference for trivial type
- also renamed local variables
2023-07-24 16:25:48 +02:00
silverqx 9302944900 added new string constant 2023-07-19 12:24:03 +02:00
silverqx 302d365a50 removed useless #include
[skip ci]
2023-07-16 15:04:40 +02:00
silverqx 30d04e6377 bugfix missing #include 2023-07-15 18:18:55 +02:00
silverqx 6534c2db08 bugfix qFatal() since Qt v6.5.0 2023-07-14 12:00:23 +02:00
silverqx a151878380 removed clang-tidy suppression 2023-07-13 14:03:43 +02:00
silverqx 0c99f2bf52 bugfix Qt5 Helpers::logException() 2023-07-13 13:51:29 +02:00
silverqx 599bb2e782 bugfix Qt5 qFatal() 2023-07-13 13:00:13 +02:00
silverqx 7d60721f73 suppressed clang-tidy warning 2023-07-13 12:59:43 +02:00
silverqx 35506f0518 added Helpers::logException() 2023-07-12 09:01:19 +02:00
silverqx 20cbda2ad8 added a new Progress constant 2023-07-11 17:42:30 +02:00
silverqx 0bb7a9c331 renamed exceptions 2023-07-11 17:37:28 +02:00
silverqx 41d2bfd0d6 modified exception messages 2023-07-11 17:18:55 +02:00
silverqx 411a635e6c added Appending Values To JSON support 🕺
These Appends are appended to the serialized models during the toMap(),
toVector(), or toJson() methods call.

Appends names are and must be mapped using the u_mutators hash map
(in the same way like u_relations) because c++ doesn't support advanced
reflection.

Appends are mapped to methods (can be protected) that return
the Casts::Attribute. This Casts::Attribute is a wrapper to return
a new attribute value.

Appends accept u_visible and u_hidden.

For the Appends that return QDate or QDateTime are the counterpart
serializeDate() or serializeDateTime() methods called.

 - added unit tests
2023-07-11 17:14:20 +02:00
silverqx 7b232992a8 changed exception message 2023-07-11 08:31:12 +02:00
silverqx 091a41e2b6 fixtypo 2023-07-11 08:31:12 +02:00
silverqx d4444e4c28 added Hiding Attributes support
A user can define the u_visible and u_hidden std::set static data
member for visible and hidden attributes on his models and they will be
used during serialization.

The relationships and also u_snakeAttributes are correctly taken into
account.

 - added unit tests
 - added example to Models::Torrent
2023-07-11 08:31:06 +02:00
silverqx d21929142d schema bugfix re-enable foreign key constraints
Re-enable foreign key constraints when exception was thrown.
2023-07-08 14:11:17 +02:00
silverqx 552ddb7556 added new detect lost connections error messages 2023-07-08 14:11:16 +02:00
silverqx 1d5d1b7fba added section comment 2023-07-07 14:51:46 +02:00
silverqx aad52a89c8 changed qt_timezone default to Qt::UTC
Previously, it was the QtTimeZoneType::DontConvert that implied the
Qt::LocalTime timezone spec.

Setting this to the Qt::UTC by default is the only way to have the
maximum level of interoperability between TinyORM and other libraries
and services.

 - updated comments in docs and source code
2023-06-29 12:07:42 +02:00
silverqx d10a72e359 removed todo tasks 2023-06-28 13:57:37 +02:00
silverqx ba57baba72 suppressed clang-tidy warning 2023-06-26 09:41:16 +02:00
silverqx 14c67efb6f workaround for null QVariant bug for QJson 🫤
Fix the null QVariant bug for QJsonDocument, replace null QVariant-s
with the QVariant(nullptr).

The QJsonValue should return null for null QVariant-s but it doesn't,
even if the Qt's QJsonValue::fromVariant() documentation explicitly
states this behavior, it says: "If QVariant::isNull() returns true,
a null QJsonValue is returned or inserted into the list or object,
regardless of the type carried by QVariant.".

But this is not happening, it returns 0 for numbers, "" for QString and
QDateTime. 🫤

 - updated unit tests
 - added unit test method to test this behavior, to test null for all
   QVariant types
2023-06-26 09:09:59 +02:00
silverqx cffc9623ec wrapped registerQMetaTypesForQt5() in #if 2023-06-18 16:32:39 +02:00
silverqx 03ff6d0fb7 registered QMetaType equal comparators 2023-06-18 16:22:52 +02:00
silverqx 49e24c0c16 added HASH_ global string constant for "hash" 2023-06-16 15:09:58 +02:00
silverqx 6514d142a6 enabled new features with clang >=16
The following problems were fixed in clang 16:

 - aggregate initialization was fixed
 - concepts were fixed
2023-06-03 19:08:36 +02:00
silverqx 73148abf0e added missing includes 2023-06-02 13:04:31 +02:00
silverqx 163f4c41e1 enhanced with(), without(), withOnly(), load()
- extracted common logic
 - added overloads
2023-05-27 19:43:39 +02:00
silverqx 16d9894ec6 added section comments 2023-05-27 19:04:20 +02:00
silverqx 25b219aab5 added comment 2023-05-24 12:36:39 +02:00
silverqx 159b5afb78 moved pivot_ constant to the Orm namespace 2023-05-19 11:37:31 +02:00
silverqx b0e645a5a7 enhanced/bugfix Grammar::getCompileMap()
Refactored to the better container, used the QVector.
2023-05-16 20:33:34 +02:00
silverqx 15c6e1a682 bugfix static_cast<> type 2023-05-16 20:02:20 +02:00