mirror of
https://github.com/silverqx/TinyORM.git
synced 2026-05-12 20:38:56 -05:00
added :memory: constant
This commit is contained in:
@@ -141,6 +141,7 @@ namespace Orm::Constants
|
||||
SHAREDLIB_EXPORT extern const QString InnoDB;
|
||||
SHAREDLIB_EXPORT extern const QString MyISAM;
|
||||
SHAREDLIB_EXPORT extern const QString postgres_;
|
||||
SHAREDLIB_EXPORT extern const QString in_memory;
|
||||
|
||||
SHAREDLIB_EXPORT extern const QString UTF8Generalci;
|
||||
SHAREDLIB_EXPORT extern const QString UTF8Unicodeci;
|
||||
@@ -170,7 +171,7 @@ namespace Orm::Constants
|
||||
SHAREDLIB_EXPORT extern const QString AND_;
|
||||
SHAREDLIB_EXPORT extern const QString NOT_;
|
||||
|
||||
// Bitewise operators
|
||||
// Bitwise operators
|
||||
SHAREDLIB_EXPORT extern const QString B_OR;
|
||||
SHAREDLIB_EXPORT extern const QString B_AND;
|
||||
|
||||
|
||||
@@ -148,6 +148,7 @@ namespace Orm::Constants
|
||||
inline const QString InnoDB = QStringLiteral("InnoDB");
|
||||
inline const QString MyISAM = QStringLiteral("MyISAM");
|
||||
inline const QString postgres_ = QStringLiteral("postgres");
|
||||
inline const QString in_memory = QStringLiteral(":memory:");
|
||||
|
||||
inline const QString UTF8Generalci = QStringLiteral("utf8_general_ci");
|
||||
inline const QString UTF8Unicodeci = QStringLiteral("utf8_unicode_ci");
|
||||
@@ -177,7 +178,7 @@ namespace Orm::Constants
|
||||
inline const QString AND_ = QStringLiteral("&&");
|
||||
inline const QString NOT_ = QStringLiteral("!");
|
||||
|
||||
// Bitewise operators
|
||||
// Bitwise operators
|
||||
inline const QString B_OR = QStringLiteral("|");
|
||||
inline const QString B_AND = QStringLiteral("&");
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ using Orm::Constants::NAME;
|
||||
using Orm::Constants::check_database_exists;
|
||||
using Orm::Constants::database_;
|
||||
using Orm::Constants::foreign_key_constraints;
|
||||
using Orm::Constants::in_memory;
|
||||
|
||||
using TypeUtils = Orm::Utils::Type;
|
||||
|
||||
@@ -32,7 +33,7 @@ SQLiteConnector::connect(const QVariantHash &config) const
|
||||
/* SQLite supports "in-memory" databases that only last as long as the owning
|
||||
connection does. These are useful for tests or for short lifetime store
|
||||
querying. In-memory databases may only have a single open connection. */
|
||||
if (config[database_].value<QString>() == QStringLiteral(":memory:")) {
|
||||
if (config[database_].value<QString>() == in_memory) {
|
||||
// sqlite :memory: driver
|
||||
createConnection(name, config, options);
|
||||
|
||||
|
||||
@@ -130,6 +130,7 @@ namespace Orm::Constants
|
||||
const QString InnoDB = QStringLiteral("InnoDB");
|
||||
const QString MyISAM = QStringLiteral("MyISAM");
|
||||
const QString postgres_ = QStringLiteral("postgres");
|
||||
const QString in_memory = QStringLiteral(":memory:");
|
||||
|
||||
const QString UTF8Generalci = QStringLiteral("utf8_general_ci");
|
||||
const QString UTF8Unicodeci = QStringLiteral("utf8_unicode_ci");
|
||||
@@ -159,7 +160,7 @@ namespace Orm::Constants
|
||||
const QString AND_ = QStringLiteral("&&");
|
||||
const QString NOT_ = QStringLiteral("!");
|
||||
|
||||
// Bitewise operators
|
||||
// Bitwise operators
|
||||
const QString B_OR = QStringLiteral("|");
|
||||
const QString B_AND = QStringLiteral("&");
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ SQLiteSchemaBuilder::dropDatabaseIfExists(const QString &name) const
|
||||
|
||||
void SQLiteSchemaBuilder::dropAllTables() const
|
||||
{
|
||||
if (m_connection->getDatabaseName() != QStringLiteral(":memory:"))
|
||||
if (m_connection->getDatabaseName() != in_memory)
|
||||
return refreshDatabaseFile(); // clazy:exclude=returning-void-expression
|
||||
|
||||
using SQLiteSchemaGrammar = Grammars::SQLiteSchemaGrammar;
|
||||
|
||||
@@ -32,6 +32,7 @@ using Orm::Constants::database_;
|
||||
using Orm::Constants::dont_drop;
|
||||
using Orm::Constants::driver_;
|
||||
using Orm::Constants::host_;
|
||||
using Orm::Constants::in_memory;
|
||||
using Orm::Constants::options_;
|
||||
using Orm::Constants::password_;
|
||||
using Orm::Constants::port_;
|
||||
@@ -781,7 +782,7 @@ void tst_DatabaseManager::SQLite_MemoryDriver() const
|
||||
{ClassName, QString::fromUtf8(__func__)}, // NOLINT(cppcoreguidelines-pro-bounds-array-to-pointer-decay)
|
||||
{
|
||||
{driver_, QSQLITE},
|
||||
{database_, QStringLiteral(":memory:")},
|
||||
{database_, in_memory},
|
||||
});
|
||||
|
||||
if (!connectionName)
|
||||
|
||||
@@ -156,6 +156,10 @@ namespace Migrations
|
||||
using TINYORM_COMMON_NAMESPACE::Orm::Constants::InnoDB; // NOLINT(misc-unused-using-decls)
|
||||
/*! Alias for the string constant "MyISAM". */
|
||||
using TINYORM_COMMON_NAMESPACE::Orm::Constants::MyISAM; // NOLINT(misc-unused-using-decls)
|
||||
/*! Alias for the string constant "postgres". */
|
||||
using TINYORM_COMMON_NAMESPACE::Orm::Constants::postgres_; // NOLINT(misc-unused-using-decls)
|
||||
/*! Alias for the string constant ":memory:". */
|
||||
using TINYORM_COMMON_NAMESPACE::Orm::Constants::in_memory; // NOLINT(misc-unused-using-decls)
|
||||
|
||||
/*! Alias for the string constant "utf8_general_ci". */
|
||||
using TINYORM_COMMON_NAMESPACE::Orm::Constants::UTF8Generalci; // NOLINT(misc-unused-using-decls)
|
||||
|
||||
@@ -258,6 +258,10 @@ namespace Seeders
|
||||
using TINYORM_COMMON_NAMESPACE::Orm::Constants::InnoDB; // NOLINT(misc-unused-using-decls)
|
||||
/*! Alias for the string constant "MyISAM". */
|
||||
using TINYORM_COMMON_NAMESPACE::Orm::Constants::MyISAM; // NOLINT(misc-unused-using-decls)
|
||||
/*! Alias for the string constant "postgres". */
|
||||
using TINYORM_COMMON_NAMESPACE::Orm::Constants::postgres_; // NOLINT(misc-unused-using-decls)
|
||||
/*! Alias for the string constant ":memory:". */
|
||||
using TINYORM_COMMON_NAMESPACE::Orm::Constants::in_memory; // NOLINT(misc-unused-using-decls)
|
||||
|
||||
/*! Alias for the string constant "utf8_general_ci". */
|
||||
using TINYORM_COMMON_NAMESPACE::Orm::Constants::UTF8Generalci; // NOLINT(misc-unused-using-decls)
|
||||
|
||||
Reference in New Issue
Block a user