Sqlite: Add Read and ReadWrite mode to database

We want open databases in read only mode too.

Change-Id: I3b20602d4bd7841c9fca3260edce082d21022052
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2017-08-01 18:32:29 +02:00
parent 52a911b972
commit 98035954c9
7 changed files with 71 additions and 11 deletions

View File

@@ -54,7 +54,7 @@ public:
void shutdownSqliteLibrary();
void checkpointFullWalLog();
void open(Utils::SmallStringView databaseFilePath);
void open(Utils::SmallStringView databaseFilePath, OpenMode openMode);
void close();
void closeWithoutException();
@@ -76,6 +76,8 @@ public:
template <typename Type>
Type toValue(Utils::SmallStringView sqlStatement);
static int openMode(OpenMode);
protected:
bool databaseIsOpen() const;
@@ -106,9 +108,11 @@ protected:
Utils::SmallStringView textEncodingToPragma(TextEncoding textEncoding);
static TextEncoding pragmaToTextEncoding(Utils::SmallStringView pragma);
Q_NORETURN static void throwExceptionStatic(const char *whatHasHappens);
Q_NORETURN void throwException(const char *whatHasHappens) const;
private:
SqliteDatabase &m_database;
sqlite3 *m_databaseHandle;