|
Isis 3 Programmer Reference
|
1 #ifndef DatabaseFactory_h
2 #define DatabaseFactory_h
16 #include <QSqlDatabase>
18 #include "CollectorMap.h"
19 #include "IException.h"
311 bool isAvailable(
const QString &dbname =
"")
const;
318 bool setAsDefault =
false);
319 void remove(
const QString &dbname);
320 void destroy(
const QString &dbname);
bool isConnected(const QString &dbname) const
Determines if the database resource is connected.
DatabaseFactory()
Constructor establishing the startup state of this singleton.
QSqlDatabase create(const QString &driver, const QString &dbname)
Create a database using the named driver.
void setDefault(const QString &name)
Sets the default name of the database.
std::vector< QString > getProfileList() const
Return list of names of currently available profiles.
DbProfile getProfile(const QString &name="") const
Get the specified database access profile.
void init()
Initializes this object upon instantiation.
QString _defDatabase
Name of default database.
void remove(const QString &dbname)
Removes the database from the connection pool.
bool setDefaultProfileName(const QString &name)
Sets the default profile to the name provided.
QString getDefaultProfileName() const
Returns the name of the default profile.
std::vector< QString > available() const
Determine what database drivers are available.
CollectorMap< IString, DbProfile, NoCaseStringCompare > Profiles
Define list of Profiles.
bool isDriverAvailable(const QString &driver) const
Check for the existance of a specific database driver.
void addProfile(const DbProfile &profile)
Adds a database access profile to the list of profiles.
bool isPersistant(const QString &name) const
Checks if the database resource is persistant.
void destroy(const QString &dbname)
Removes the database from the connection pool and destroys it.
bool isAvailable(const QString &dbname="") const
Check for availablity of a database connection resource.
void add(const QSqlDatabase &db, const QString &name, bool setAsDefault=false)
Adds the database to the connection pool making it persistant.
bool exists(const K &key) const
Checks the existance of a particular key in the list.
CollectorMap< IString, QSqlDatabase, NoCaseStringCompare > Databases
Define active database maintainer.
void selfDestruct()
Destroy all elements associated with this object.
void loadDrivers()
Load any drivers explicity.
static DatabaseFactory * _factory
Pointer to self (singleton)
bool addAccessProfile(const QString &profileFile)
Establishes an access profile for subsequent database connections.
Databases _dbList
Maintains active databases.
A DbProfile is a container for access parameters to a database.
Create database interfaces using access profiles or generic drivers.
static DatabaseFactory * getInstance()
Returns and instance of this DatabaseFactory singleton.
CollectorMap< IString, QString, NoCaseStringCompare > Drivers
Define list of drivers and/or databases
Collector/container for arbitrary items.
Drivers getResourceList(bool drivers, bool connections) const
Get a list of available database drivers and connections.
static void DieAtExit()
Exit termination routine.
QString getDefault() const
Returns the name of the default database.
~DatabaseFactory()
Destructor implements self-destruction of this object.
QString _defProfName
Default profile name.
void initPreferences()
Initializes user database preferences.
This is free and unencumbered software released into the public domain.
Profiles _profiles
Maintain list of profiles.