Skip to content

Commit

Permalink
tom built MySQL connection only with TinyDrivers
Browse files Browse the repository at this point in the history
  • Loading branch information
silverqx committed Apr 23, 2024
1 parent c4756e9 commit f7a36ca
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions examples/tom/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ std::shared_ptr<DatabaseManager> setupDatabaseManager()

// Ownership of the shared_ptr()
return DB::create({
#if !PROJECT_TINYDRIVERS || TINYDRIVERS_MYSQL_DRIVER
// MySQL connection
{QStringLiteral("tinyorm_tom_mysql"), { // shell:connection
{driver_, QMYSQL},
Expand Down Expand Up @@ -120,7 +121,8 @@ std::shared_ptr<DatabaseManager> setupDatabaseManager()
{Version, {}}, // Autodetect
{options_, ConfigUtils::mariaSslOptions()},
}},

#endif
#if !PROJECT_TINYDRIVERS || TINYDRIVERS_PSQL_DRIVER
// PostgreSQL connection
{QStringLiteral("tinyorm_tom_postgres"), { // shell:connection
{driver_, QPSQL},
Expand Down Expand Up @@ -154,7 +156,8 @@ std::shared_ptr<DatabaseManager> setupDatabaseManager()
// {dont_drop, QStringList {spatial_ref_sys}},
{options_, ConfigUtils::postgresSslOptions()},
}},

#endif
#if !PROJECT_TINYDRIVERS || TINYDRIVERS_SQLITE_DRIVER
// SQLite connection
{QStringLiteral("tinyorm_tom_sqlite"), { // shell:connection
{driver_, QSQLITE},
Expand All @@ -171,6 +174,7 @@ std::shared_ptr<DatabaseManager> setupDatabaseManager()
{prefix_, EMPTY},
{prefix_indexes, false},
}}
#endif
},
// MySQL as the default database connection
QStringLiteral("tinyorm_tom_mysql"));
Expand Down
8 changes: 6 additions & 2 deletions tests/testdata_tom/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ std::shared_ptr<DatabaseManager> setupDatabaseManager()

// Ownership of the shared_ptr()
return DB::create({
#if !PROJECT_TINYDRIVERS || TINYDRIVERS_MYSQL_DRIVER
// MySQL connection
{sl("tinyorm_testdata_tom_mysql"), { // shell:connection
{driver_, QMYSQL},
Expand Down Expand Up @@ -135,7 +136,8 @@ std::shared_ptr<DatabaseManager> setupDatabaseManager()
{Version, {}}, // Autodetect
{options_, ConfigUtils::mariaSslOptions()},
}},

#endif
#if !PROJECT_TINYDRIVERS || TINYDRIVERS_PSQL_DRIVER
// PostgreSQL connection
{sl("tinyorm_testdata_tom_postgres"), { // shell:connection
{driver_, QPSQL},
Expand All @@ -160,7 +162,8 @@ std::shared_ptr<DatabaseManager> setupDatabaseManager()
// {dont_drop, QStringList {spatial_ref_sys}},
{options_, ConfigUtils::postgresSslOptions()},
}},

#endif
#if !PROJECT_TINYDRIVERS || TINYDRIVERS_SQLITE_DRIVER
// SQLite connection
{sl("tinyorm_testdata_tom_sqlite"), { // shell:connection
{driver_, QSQLITE},
Expand All @@ -177,6 +180,7 @@ std::shared_ptr<DatabaseManager> setupDatabaseManager()
{prefix_, EMPTY},
{prefix_indexes, false},
}}
#endif
},
/* Because the default connection name is not defined, then will be needed
to provide the connection name using the --database=xyz argument. */
Expand Down

0 comments on commit f7a36ca

Please sign in to comment.