|
|
@ -187,7 +187,7 @@ public:
|
|
|
|
TQDataBase db = TQSqlDatabase::addDatabase(SQLTYPE,_key);
|
|
|
|
TQDataBase db = TQSqlDatabase::addDatabase(SQLTYPE,_key);
|
|
|
|
db->setDatabaseName(m_BasePath+"/maindb.db");
|
|
|
|
db->setDatabaseName(m_BasePath+"/maindb.db");
|
|
|
|
if (!db->open()) {
|
|
|
|
if (!db->open()) {
|
|
|
|
qWarning("Failed to open main database: " + db->lastError().text());
|
|
|
|
qWarning(TQString("Failed to open main database: " + db->lastError().text()).ascii());
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
m_mainDB.setLocalData(new ThreadDBStore);
|
|
|
|
m_mainDB.setLocalData(new ThreadDBStore);
|
|
|
|
m_mainDB.localData()->key = _key;
|
|
|
|
m_mainDB.localData()->key = _key;
|
|
|
@ -269,12 +269,12 @@ void LogCache::setupMainDb()
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
TQDataBase mainDB = m_CacheData->getMainDB();
|
|
|
|
TQDataBase mainDB = m_CacheData->getMainDB();
|
|
|
|
if (!mainDB || !mainDB->open()) {
|
|
|
|
if (!mainDB || !mainDB->open()) {
|
|
|
|
qWarning("Failed to open main database: " + (mainDB?mainDB->lastError().text():"No database object."));
|
|
|
|
qWarning(TQString("Failed to open main database: " + (mainDB?mainDB->lastError().text():"No database object.")).ascii());
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
TQSqlQuery q(TQString(), mainDB);
|
|
|
|
TQSqlQuery q(TQString(), mainDB);
|
|
|
|
mainDB->transaction();
|
|
|
|
mainDB->transaction();
|
|
|
|
if (!q.exec("CREATE TABLE IF NOT EXISTS \""+TQString(SQLMAINTABLE)+"\" (\"reposroot\" TEXT,\"id\" INTEGER PRIMARY KEY NOT NULL);")) {
|
|
|
|
if (!q.exec("CREATE TABLE IF NOT EXISTS \""+TQString(SQLMAINTABLE)+"\" (\"reposroot\" TEXT,\"id\" INTEGER PRIMARY KEY NOT NULL);")) {
|
|
|
|
qWarning("Failed create main database: " + mainDB->lastError().text());
|
|
|
|
qWarning(TQString("Failed create main database: " + mainDB->lastError().text()).ascii());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mainDB->commit();
|
|
|
|
mainDB->commit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|