Commit e313459c authored by Karel Slaný's avatar Karel Slaný

Removed SQLiteDb::deleteCurrentDbCreateNew().

parent 812a97a5
......@@ -315,44 +315,6 @@ bool SQLiteDb::createDb(const QString &newLocDir,
return openDb(newFileName, true, tables);
}
bool SQLiteDb::deleteCurrentDbCreateNew(const QString &newLocDir,
const QList<class SQLiteTbl *> &tables)
{
bool open_ret;
/* Close database. */
m_db.close();
/* Backup old file name. */
QString oldFileName = fileName();
QFileInfo fi(oldFileName);
QString fileName = fi.fileName();
QString newFileName =
newLocDir + QDir::separator() + QDir::toNativeSeparators(fileName);
/* Fail if target equals the source. */
/* TODO -- Perform a more reliable check than string comparison. */
if (oldFileName == newFileName) {
return false;
}
/* Erase target if exists. */
QFile::remove(newFileName);
/*
* Open database in the new location.
* If error durring opening of new dabatase, open back old database.
*/
open_ret = openDb(newFileName, true, tables);
if (!open_ret) {
open_ret = openDb(oldFileName, true, tables);
return false;
}
/* Delete file. */
return QFile::remove(oldFileName);
}
bool SQLiteDb::deleteDb(const QString &LocDir)
{
/* Close database. */
......
......@@ -148,17 +148,6 @@ protected:
bool createDb(const QString &newLocDir,
const QList<class SQLiteTbl *> &tables);
/*!
* @brief Delete current message db and create new in new location.
*
* @param[in] newLocDir New location name.
* @param[in] tables List of table prototypes that should be created
* if missing.
* @return True on success.
*/
bool deleteCurrentDbCreateNew(const QString &newLocDir,
const QList<class SQLiteTbl *> &tables);
/*!
* @brief Delete database from location.
*
......
......@@ -113,11 +113,6 @@ bool FileDb::createDb(const QString &newLocDir)
return SQLiteDb::createDb(newLocDir, listOfTables());
}
bool FileDb::deleteCurrentDbCreateNew(const QString &newLocDir)
{
return SQLiteDb::deleteCurrentDbCreateNew(newLocDir, listOfTables());
}
bool FileDb::deleteDb(const QString &LocDir)
{
return SQLiteDb::deleteDb(LocDir);
......
......@@ -83,14 +83,6 @@ public:
*/
bool createDb(const QString &newLocDir);
/*!
* @brief Delete current file db and create new in new location.
*
* @param[in] newLocDir New location name.
* @return True on success.
*/
bool deleteCurrentDbCreateNew(const QString &newLocDir);
/*!
* @brief Delete database from location.
*
......
......@@ -66,11 +66,6 @@ bool MessageDb::createDb(const QString &newLocDir)
return SQLiteDb::createDb(newLocDir, listOfTables());
}
bool MessageDb::deleteCurrentDbCreateNew(const QString &newLocDir)
{
return SQLiteDb::deleteCurrentDbCreateNew(newLocDir, listOfTables());
}
bool MessageDb::deleteDb(const QString &LocDir)
{
return SQLiteDb::deleteDb(LocDir);
......
......@@ -71,14 +71,6 @@ public:
*/
bool createDb(const QString &newLocDir);
/*!
* @brief Delete current message db and create new in new location.
*
* @param[in] newLocDir New location name.
* @return True on success.
*/
bool deleteCurrentDbCreateNew(const QString &newLocDir);
/*!
* @brief Delete database from location.
*
......
......@@ -90,11 +90,6 @@ fail:
return false;
}
bool ZfoDb::deleteCurrentDbCreateNew(const QString &newLocDir)
{
return SQLiteDb::deleteCurrentDbCreateNew(newLocDir, listOfTables());
}
bool ZfoDb::createDb(const QString &newLocDir)
{
return SQLiteDb::createDb(newLocDir, listOfTables());
......
......@@ -49,14 +49,6 @@ public:
*/
bool createDb(const QString &newLocDir);
/*!
* @brief Delete current zfo db and create new in new location.
*
* @param[in] newLocDir New location name.
* @return True on success.
*/
bool deleteCurrentDbCreateNew(const QString &newLocDir);
/*!
* @brief Delete database from location.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment