30 #include <QStringList> 
   37   QString Database::_actualConnectionName = 
"";
 
   67     _name = _actualConnectionName;
 
   68     if((dbConn == 
Connect) && isValid()) {
 
   70         QString mess = 
"Failed to open database default database [" + 
_name;
 
   90     _name = _actualConnectionName;
 
   91     if((dbConn == 
Connect) && isValid()) {
 
   93         QString mess = 
"Failed to open database specified as " + 
_name;
 
  118     QSqlDatabase(init(connName, driverType)), _name(connName) {
 
  119     _name = _actualConnectionName;
 
  139     _name(profile.Name()) {
 
  140     _name = _actualConnectionName;
 
  141     if((dbConn == 
Connect) && isValid()) {
 
  143         QString mess = 
"Failed to open database with profile " + 
_name;
 
  357                               const QString &driverType) {
 
  359     _actualConnectionName = connName;
 
  365     if(connName.isEmpty() && driverType.isEmpty()) {
 
  367         _actualConnectionName = factory->
getDefault();
 
  368         return (factory->
create(_actualConnectionName));
 
  379     if((!connName.isEmpty()) && (driverType.isEmpty())) {
 
  381         _actualConnectionName = connName;
 
  382         return (factory->
create(connName));
 
  393     return (factory->
create(driverType, connName));
 
  419       mess << 
"Database/profile [" << profile.
Name() << 
"] is not valid!" << ends;
 
  423     _actualConnectionName = profile.
Name();
 
  432       _actualConnectionName = profile(
"Name");
 
  438           QString mess = 
"Failed to connect to database using profile " +
 
  446       QString mess = 
"Unable to create database from " + profile.
Name();
 
  450       QString mess = 
"Unknown exception while creating database from profile " 
  469     if(profile.
exists(
"Host")) {
 
  470       db.setHostName(profile(
"Host"));
 
  473     if(profile.
exists(
"DbName")) {
 
  474       db.setDatabaseName(profile(
"DbName"));
 
  477     if(profile.
exists(
"User")) {
 
  478       db.setUserName(profile(
"User"));
 
  481     if(profile.
exists(
"Password")) {
 
  482       db.setPassword(profile(
"Password"));
 
  485     if(profile.
exists(
"Port")) {
 
  487       db.setPort(profile(
"Port").
toInt(&ok));
 
  490         mess << 
"Invalid port number [" << profile(
"Port") << 
"] in profile " 
  491              << profile(
"Name") << ends;
 
  496     if(profile.
exists(
"Options")) {
 
  497       db.setConnectOptions(profile(
"Options"));
 
  525     return (tables(QSql::Tables));
 
  538     return (tables(QSql::Views));
 
  550     return (tables(QSql::SystemTables));
 
  564     QString errmess = message + 
" - DatabaseError = " +
 
QStringList getSystemTables() const 
Returns vector strings of all available system tables in the database. 
 
DbProfile getProfile(const QString &name="") const 
Get the specified database access profile. 
 
void tossDbError(const QString &message, const char *f, int l) const 
Generic exception tosser. 
 
void setDefault(const QString &name)
Sets the default name of the database. 
 
QString Name() const 
Returns the name of this property. 
 
bool isAvailable(const QString &dbname="") const 
Check for availablity of a database connection resource. 
 
QString getDefault() const 
Returns the name of the default database. 
 
int toInt(const QString &string)
Global function to convert from a string to an integer. 
 
Do not connect to database. 
 
static DatabaseFactory * getInstance()
Returns and instance of this DatabaseFactory singleton. 
 
Connect to database immediately. 
 
This error is for when a programmer made an API call that was illegal. 
 
Create database interfaces using access profiles or generic drivers. 
 
bool isValid() const 
Reports if this is a valid profile. 
 
A DbProfile is a container for access parameters to a database. 
 
static DbProfile getProfile(const QString &name)
Retrieves the named database access profile. 
 
bool addAccessProfile(const QString &profileFile)
Establishes an access profile for subsequent database connections. 
 
void setAsDefault()
Sets this database connection/profile as the default. 
 
QStringList getViews() const 
Returns a vector string containing all views within the database. 
 
Access
Access status for database creation. 
 
QSqlDatabase init(const DbProfile &profile, Access dbConn=Connect)
Create and initialize a new database connection from a DbProfile. 
 
#define _FILEINFO_
Macro for the filename and line number. 
 
bool isPersistant() const 
Checks persistancy state of a database instantiation. 
 
A type of error that could only have occurred due to a mistake on the user's part (e...
 
QString _name
Needed due to peculiar issues with Database construction techniques. 
 
virtual ~Database()
Database destructor. 
 
void add(const QSqlDatabase &db, const QString &name, bool setAsDefault=false)
Adds the database to the connection pool making it persistant. 
 
Isis database class providing generalized access to a variety of databases. 
 
void remove(const QString &dbname)
Removes the database from the connection pool. 
 
bool exists(const QString &key) const 
Checks for the existance of a keyword. 
 
QStringList getTables() const 
Returns a vector string containing all the tables in the database. 
 
void configureAccess(QSqlDatabase &db, const DbProfile &profile)
Set access parameters from a database DbProfile access specification. 
 
void makePersistant()
Makes this instance persistant. 
 
static void remove(const QString &name)
Removes the named database from pool. 
 
static bool addAccessConfig(const QString &confFile)
Adds a user specifed access configuration file to system. 
 
Database()
Default database constructor. 
 
void destroy(const QString &dbname)
Removes the database from the connection pool and destroys it. 
 
bool isPersistant(const QString &name) const 
Checks if the database resource is persistant. 
 
QSqlDatabase create(const QString &driver, const QString &dbname)
Create a database using the named driver. 
 
Database clone(const QString &name) const 
Clones this database into another giving it another name.