43 :
TorcDB(DatabaseName, QStringLiteral(
"QSQLITE"))
53 QMutexLocker locker(&
m_lock);
54 LOG(VB_GENERAL, LOG_INFO, QStringLiteral(
"Attempting to open '%1'")
61 LOG(VB_GENERAL, LOG_ERR, QStringLiteral(
"Failed to get valid database connection."));
67 LOG(VB_GENERAL, LOG_ERR, QStringLiteral(
"Failed to open database."));
73 query.exec(QStringLiteral(
"PRAGMA locking_mode = NORMAL"));
78 query.exec(
"CREATE TABLE IF NOT EXISTS settings " 79 "( name VARCHAR(128) NOT NULL," 80 " value VARCHAR(16000) NOT NULL );");
84 query.exec(QStringLiteral(
"SELECT value FROM settings where name='DB_DateCreated'"));
90 LOG(VB_GENERAL, LOG_INFO, QStringLiteral(
"Settings table was created on %1")
91 .arg(query.value(0).toString()));
95 LOG(VB_GENERAL, LOG_INFO, QStringLiteral(
"Initialising settings table."));
96 QString createdon = QDateTime::currentDateTimeUtc().toString(Qt::ISODate);
98 QStringLiteral(
"INSERT INTO settings (name, value) VALUES ('DB_DateCreated', '%1');")
104 query.exec(QStringLiteral(
"PRAGMA page_size = 4096"));
106 query.exec(QStringLiteral(
"PRAGMA cache_size = 16384"));
108 query.exec(QStringLiteral(
"PRAGMA temp_store = MEMORY"));
110 query.exec(QStringLiteral(
"PRAGMA journal_mode = OFF"));
112 query.exec(QStringLiteral(
"PRAGMA synchronous = OFF"));
TorcSQLiteDB(const QString &DatabaseName)
QString GetThreadConnection(void)
Retrieve a database connection for the current thread.
Base Sql database access class.
bool InitDatabase(void) override
Create and/or open an SQLiteDatabase.
#define LOG(_MASK_, _LEVEL_, _STRING_)
static bool DebugError(QSqlQuery *Query)
Log database errors following a failed query.