mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-08-02 10:04:12 +02:00
Wrap deprecated QSqlDatabase::exec() in QSqlQuery
QSqlDatabase::exec(const QString&) is deprecated in Qt6. Route the PRAGMA/CREATE TABLE statements through QSqlQuery(db).exec() instead. Clears 11 -Wdeprecated-declarations warnings; same statements, same database connection, no behavioural change.
This commit is contained in:
@@ -253,9 +253,9 @@ bool projectDataBase::createDataBase()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_data_base.exec("PRAGMA temp_store = MEMORY");
|
QSqlQuery(m_data_base).exec("PRAGMA temp_store = MEMORY");
|
||||||
m_data_base.exec("PRAGMA journal_mode = MEMORY");
|
QSqlQuery(m_data_base).exec("PRAGMA journal_mode = MEMORY");
|
||||||
m_data_base.exec("PRAGMA synchronous = OFF");
|
QSqlQuery(m_data_base).exec("PRAGMA synchronous = OFF");
|
||||||
|
|
||||||
QSqlQuery query_(m_data_base);
|
QSqlQuery query_(m_data_base);
|
||||||
bool first_ = true;
|
bool first_ = true;
|
||||||
|
|||||||
@@ -45,18 +45,18 @@ ElementsCollectionCache::ElementsCollectionCache(const QString &database_path, Q
|
|||||||
qDebug() << "Unable to open the SQLite database " << database_path << " as " << connection_name << ": " << cache_db_.lastError();
|
qDebug() << "Unable to open the SQLite database " << database_path << " as " << connection_name << ": " << cache_db_.lastError();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cache_db_.exec("PRAGMA temp_store = MEMORY");
|
QSqlQuery(cache_db_).exec("PRAGMA temp_store = MEMORY");
|
||||||
cache_db_.exec("PRAGMA journal_mode = MEMORY");
|
QSqlQuery(cache_db_).exec("PRAGMA journal_mode = MEMORY");
|
||||||
cache_db_.exec("PRAGMA page_size = 4096");
|
QSqlQuery(cache_db_).exec("PRAGMA page_size = 4096");
|
||||||
cache_db_.exec("PRAGMA cache_size = 16384");
|
QSqlQuery(cache_db_).exec("PRAGMA cache_size = 16384");
|
||||||
cache_db_.exec("PRAGMA locking_mode = EXCLUSIVE");
|
QSqlQuery(cache_db_).exec("PRAGMA locking_mode = EXCLUSIVE");
|
||||||
cache_db_.exec("PRAGMA synchronous = OFF");
|
QSqlQuery(cache_db_).exec("PRAGMA synchronous = OFF");
|
||||||
|
|
||||||
#if TODO_LIST
|
#if TODO_LIST
|
||||||
#pragma message("@TODO the tables could already exist, handle that case.")
|
#pragma message("@TODO the tables could already exist, handle that case.")
|
||||||
#endif
|
#endif
|
||||||
//@TODO the tables could already exist, handle that case.
|
//@TODO the tables could already exist, handle that case.
|
||||||
cache_db_.exec("CREATE TABLE names"
|
QSqlQuery(cache_db_).exec("CREATE TABLE names"
|
||||||
"("
|
"("
|
||||||
"path VARCHAR(512) NOT NULL,"
|
"path VARCHAR(512) NOT NULL,"
|
||||||
"locale VARCHAR(2) NOT NULL,"
|
"locale VARCHAR(2) NOT NULL,"
|
||||||
@@ -65,7 +65,7 @@ ElementsCollectionCache::ElementsCollectionCache(const QString &database_path, Q
|
|||||||
"PRIMARY KEY(path, locale)"
|
"PRIMARY KEY(path, locale)"
|
||||||
");");
|
");");
|
||||||
|
|
||||||
cache_db_.exec("CREATE TABLE pixmaps"
|
QSqlQuery(cache_db_).exec("CREATE TABLE pixmaps"
|
||||||
"("
|
"("
|
||||||
"path VARCHAR(512) NOT NULL UNIQUE,"
|
"path VARCHAR(512) NOT NULL UNIQUE,"
|
||||||
"uuid VARCHAR(512) NOT NULL,"
|
"uuid VARCHAR(512) NOT NULL,"
|
||||||
|
|||||||
Reference in New Issue
Block a user