summaryrefslogtreecommitdiffhomepage
path: root/storage.h
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2023-01-01 03:13:00 +0100
committerRoland Reichwein <mail@reichwein.it>2023-01-01 03:13:00 +0100
commitd5861096a975274fcce72b45fe4ed38c96c61610 (patch)
treeee97aa2a5e4ba9f25df32569ed90d8fc9338be16 /storage.h
parent9465fd744cc2117190bafc1a3e2da9f10ca29bf9 (diff)
(Re-)Use precompiled SQL statements
Diffstat (limited to 'storage.h')
-rw-r--r--storage.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/storage.h b/storage.h
index dc4e216..24f2961 100644
--- a/storage.h
+++ b/storage.h
@@ -1,5 +1,6 @@
#pragma once
+#include <memory>
#include <string>
#include <tuple>
@@ -11,6 +12,7 @@ class Storage
{
public:
Storage(const Config& config);
+ ~Storage();
uint64_t getNumberOfDocuments();
bool exists(const std::string& id);
@@ -30,5 +32,20 @@ public:
private:
SQLite::Database m_db;
uint64_t m_maxage;
+
+ // shared_ptr to work around initialization in constructor
+ std::shared_ptr<SQLite::Statement> m_stmt_create;
+ std::shared_ptr<SQLite::Statement> m_stmt_getNumberOfDocuments;
+ std::shared_ptr<SQLite::Statement> m_stmt_cleanup;
+ std::shared_ptr<SQLite::Statement> m_stmt_exists;
+ std::shared_ptr<SQLite::Statement> m_stmt_getDocument;
+ std::shared_ptr<SQLite::Statement> m_stmt_getRevision;
+ std::shared_ptr<SQLite::Statement> m_stmt_getCursorPos;
+ std::shared_ptr<SQLite::Statement> m_stmt_getRow;
+ std::shared_ptr<SQLite::Statement> m_stmt_setDocument;
+ std::shared_ptr<SQLite::Statement> m_stmt_setDocument_new;
+ std::shared_ptr<SQLite::Statement> m_stmt_setRevision;
+ std::shared_ptr<SQLite::Statement> m_stmt_setCursorPos;
+ std::shared_ptr<SQLite::Statement> m_stmt_setRow;
};