Changeset cec47c6 for src/sql


Ignore:
Timestamp:
05/05/10 15:56:14 (12 years ago)
Author:
kirilma <kirilma@…>
Branches:
master, qt5
Children:
58eb7cc
Parents:
3cdaf7d
Message:

store path to conference map in database

path stored as additional field in conference table
if it's null or empty, "Show map" button is not shown
if existing database does not have the field, it will be automatically added

Location:
src/sql
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/sql/sqlengine.cpp

    r3cdaf7d rcec47c6  
    6262        database.open();
    6363    }
     64
     65    checkConferenceMap(database);
    6466
    6567    //LOG_INFO(QString("Opening '%1' database '%2'").arg(aDatabaseType).arg(aDatabaseName));
     
    378380}
    379381
     382void SqlEngine::checkConferenceMap(QSqlDatabase &aDatabase)
     383{
     384    QSqlQuery sqlQuery(aDatabase);
     385    sqlQuery.prepare("SELECT map FROM conference");
     386    if (!sqlQuery.exec()) {
     387        qWarning() << "column conference.map is missing; adding";
     388        execQuery(aDatabase, "ALTER TABLE conference ADD COLUMN map VARCHAR")
     389         and execQuery(aDatabase, "UPDATE conference SET map = ':/maps/campus.png' WHERE title = 'FOSDEM 2010'");
     390    }
     391}
  • src/sql/sqlengine.h

    r3cdaf7d rcec47c6  
    4848        static bool execQuery(QSqlDatabase &aDatabase, const QString &aQuery);
    4949        static bool execQueryWithParameter(QSqlDatabase &aDatabase, const QString &aQuery, const QHash<QString, QVariant>& params);
     50
     51        static void checkConferenceMap(QSqlDatabase &aDatabase);
    5052};
    5153
Note: See TracChangeset for help on using the changeset viewer.