mirror of
https://github.com/silverqx/TinyORM.git
synced 2026-01-06 19:09:33 -06:00
added SQLite database support 🔥🚀✨
- all tests are ran against SQLite test database too 🎉🔥 - removed default models connection for tests, because I'm testing models for all database connections and the connection is controlled by global test data, so every test is ran against all the supported databases - added test code controlled by TINYORM_TESTS_CODE preprocessor macro, which enables connection override in the BaseModel - build tests only when the "CONFIG += build_tests" was added to the qmake command added php script to create databases - script creates MySQL and SQLite databases - script populate this databases with test data - connection credentials are provided through the DB_ env. variables other changes - added api to enable statement counters for the given connections - added BaseModel::truncate test
This commit is contained in:
33
src/orm/sqliteconnection.cpp
Normal file
33
src/orm/sqliteconnection.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "orm/sqliteconnection.hpp"
|
||||
|
||||
#include "orm/query/grammars/sqlitegrammar.hpp"
|
||||
|
||||
#ifdef TINYORM_COMMON_NAMESPACE
|
||||
namespace TINYORM_COMMON_NAMESPACE
|
||||
{
|
||||
#endif
|
||||
namespace Orm
|
||||
{
|
||||
|
||||
SQLiteConnection::SQLiteConnection(
|
||||
const std::function<Connectors::ConnectionName()> &connection,
|
||||
const QString &database, const QString tablePrefix,
|
||||
const QVariantHash &config
|
||||
)
|
||||
: DatabaseConnection(connection, database, tablePrefix, config)
|
||||
{
|
||||
/* We need to initialize a query grammar that is a very important part
|
||||
of the database abstraction, so we initialize it to the default value
|
||||
while starting. */
|
||||
useDefaultQueryGrammar();
|
||||
}
|
||||
|
||||
std::unique_ptr<QueryGrammar> SQLiteConnection::getDefaultQueryGrammar() const
|
||||
{
|
||||
return std::make_unique<Query::Grammars::SQLiteGrammar>();
|
||||
}
|
||||
|
||||
} // namespace Orm
|
||||
#ifdef TINYORM_COMMON_NAMESPACE
|
||||
} // namespace TINYORM_COMMON_NAMESPACE
|
||||
#endif
|
||||
Reference in New Issue
Block a user