Commit 4607e3d0 authored by Kelvin Rodriguez's avatar Kelvin Rodriguez
Browse files

drivers now being loaded properly

parent 9782b4dd
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -26,10 +26,11 @@

using namespace std;


#include <QDebug>
#include <QString>
#include <QStringList>
#include <QCoreApplication>
#include <QSqlDatabase>

#include "DatabaseFactory.h"
#include "DbAccess.h"
@@ -69,6 +70,8 @@ namespace Isis {
  DatabaseFactory::DatabaseFactory() : _defProfName(""),  _profiles(),
    _defDatabase(""), _dbList() {

    // insure the drivers are being loaded
    loadDrivers();
    //  Checks the existance of the Qt application core.  This is required in order
    //  ensure database driver plugins are loaded - if they exist.
    QCoreApplication *cApp = QCoreApplication::instance();
@@ -367,6 +370,8 @@ namespace Isis {
   */
  QSqlDatabase DatabaseFactory::create(const QString &driver,
                                       const QString &dbname) {


    // Check driver availability
    if(!isDriverAvailable(driver)) {
      QString mess = "Driver [" + driver + "] for database [" + dbname
@@ -555,8 +560,7 @@ namespace Isis {
      dbDrivers.add("SQLite", "QSQLITE");
    }

    //  That's it
    return (dbDrivers);
    return dbDrivers;
  }

  /**
@@ -570,6 +574,8 @@ namespace Isis {
   */
  void DatabaseFactory::loadDrivers() {
    //  Currently relying on Qt plugins - but that could change
    // Hack to insure drivers are being loaded correctly
    QSqlDatabase::drivers();
    return;
  }

+2 −1
Original line number Diff line number Diff line
#include "Database.h"

#include <QFile>
#include <QSqlDatabase>
#include <QDebug>

#include "FileName.h"
#include "SqlQuery.h"
@@ -12,7 +14,6 @@ using namespace Isis;

int main(int argc, char *argv[]) {
  Isis::Preference::Preferences(true);

  // SQLite
  FileName dbfile("$TEMPORARY/test.db");
  Database testdb("testdb", "SQLite");