Database: Crash on obvious errors to gain attention

The database now crashes Kaidan when an invalid version number should
be saved and when an existing table should be created.
parent 572e4990
Pipeline #25616 passed with stages
in 12 minutes and 36 seconds
......@@ -62,7 +62,7 @@
#define SQL_BLOB "BLOB"
#define SQL_CREATE_TABLE(tableName, contents) \
"CREATE TABLE IF NOT EXISTS '" QT_STRINGIFY(tableName) "' (" contents ")"
"CREATE TABLE '" QT_STRINGIFY(tableName) "' (" contents ")"
#define SQL_LAST_ATTRIBUTE(name, dataType) \
"'" QT_STRINGIFY(name) "' " dataType
......@@ -160,6 +160,9 @@ void Database::loadDatabaseInfo()
void Database::saveDatabaseInfo()
{
if (m_version < 2 || m_version > DATABASE_LATEST_VERSION)
qFatal("[database] Fatal error: Attempted to save invalid db version number.");
QSqlRecord updateRecord;
updateRecord.append(Utils::createSqlField("version", m_version));
......
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