mirror of
https://github.com/silverqx/TinyORM.git
synced 2026-01-06 02:49:31 -06:00
added containsConnection() to DB/DatabaseManager
This commit is contained in:
@@ -138,6 +138,8 @@ namespace Query
|
||||
const QString &defaultConnection);
|
||||
/*! Remove the given connection from the manager. */
|
||||
bool removeConnection(const QString &name = "");
|
||||
/*! Determine whether a given connection is already registered. */
|
||||
bool containsConnection(const QString &name = "");
|
||||
|
||||
/*! Reconnect to the given database. */
|
||||
DatabaseConnection &reconnect(const QString &name = "");
|
||||
|
||||
@@ -62,6 +62,8 @@ namespace Orm
|
||||
const QString &defaultConnection);
|
||||
/*! Remove the given connection from the manager. */
|
||||
static bool removeConnection(const QString &name = "");
|
||||
/*! Determine whether a given connection is already registered. */
|
||||
static bool containsConnection(const QString &name = "");
|
||||
|
||||
/*! Reconnect to the given database. */
|
||||
static DatabaseConnection &reconnect(const QString &name = "");
|
||||
|
||||
@@ -313,6 +313,11 @@ bool DatabaseManager::removeConnection(const QString &name)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DatabaseManager::containsConnection(const QString &name)
|
||||
{
|
||||
return (*m_connections).contains(name);
|
||||
}
|
||||
|
||||
DatabaseConnection &DatabaseManager::reconnect(const QString &name)
|
||||
{
|
||||
const auto &name_ = parseConnectionName(name);
|
||||
|
||||
@@ -62,6 +62,11 @@ bool DB::removeConnection(const QString &name)
|
||||
return manager().removeConnection(name);
|
||||
}
|
||||
|
||||
bool DB::containsConnection(const QString &name)
|
||||
{
|
||||
return manager().containsConnection(name);
|
||||
}
|
||||
|
||||
DatabaseConnection &DB::reconnect(const QString &name)
|
||||
{
|
||||
return manager().reconnect(name);
|
||||
|
||||
Reference in New Issue
Block a user