mirror of
https://github.com/silverqx/TinyORM.git
synced 2025-12-20 18:09:30 -06:00
The MySQL >=8.0.19 supports aliases in the VALUES and SET clauses of INSERT INTO ... ON DUPLICATE KEY UPDATE statement for the row to be inserted and its columns. It also generates warning from >=8.0.20 if an old style used. This enhancement detects the MySQL version and on the base of it uses alias during the upsert call. Also a user can override the version through the MySQL database configuration. It helps to save/avoid one database query (select version()) during the upsert method call or during connecting to the MySQL database (version is needed if strict mode is enabled). - added unit and functional tests - updated number of unit tests to 1402 - updated upsert docs - added ConfigUtils to avoid duplicates Others: - added the version database configuration everywhere - docs added few lines about MySQL version configuration option - docs updated database configurations, added a new missing options
40 lines
995 B
C++
40 lines
995 B
C++
#pragma once
|
|
#ifndef ORM_UTILS_CONFIG_HPP
|
|
#define ORM_UTILS_CONFIG_HPP
|
|
|
|
#include "orm/macros/systemheader.hpp"
|
|
TINY_SYSTEM_HEADER
|
|
|
|
#include <QtGlobal>
|
|
|
|
#include "orm/macros/commonnamespace.hpp"
|
|
#include "orm/macros/export.hpp"
|
|
|
|
TINYORM_BEGIN_COMMON_NAMESPACE
|
|
|
|
namespace Orm::Utils
|
|
{
|
|
|
|
/*! Database configuration related library class. */
|
|
class SHAREDLIB_EXPORT Configuration
|
|
{
|
|
Q_DISABLE_COPY(Configuration)
|
|
|
|
public:
|
|
/*! Deleted default constructor, this is a pure library class. */
|
|
Configuration() = delete;
|
|
/*! Deleted destructor. */
|
|
~Configuration() = delete;
|
|
|
|
/*! Determine whether the database config. contains a valid version value. */
|
|
static bool hasValidConfigVersion(const QVariantHash &config);
|
|
/*! Get a valid config. version value. */
|
|
static QString getValidConfigVersion(const QVariantHash &config);
|
|
};
|
|
|
|
} // namespace Orm::Utils
|
|
|
|
TINYORM_END_COMMON_NAMESPACE
|
|
|
|
#endif // ORM_UTILS_CONFIG_HPP
|