From d5861096a975274fcce72b45fe4ed38c96c61610 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sun, 1 Jan 2023 03:13:00 +0100 Subject: (Re-)Use precompiled SQL statements --- storage.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'storage.h') 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 #include #include @@ -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 m_stmt_create; + std::shared_ptr m_stmt_getNumberOfDocuments; + std::shared_ptr m_stmt_cleanup; + std::shared_ptr m_stmt_exists; + std::shared_ptr m_stmt_getDocument; + std::shared_ptr m_stmt_getRevision; + std::shared_ptr m_stmt_getCursorPos; + std::shared_ptr m_stmt_getRow; + std::shared_ptr m_stmt_setDocument; + std::shared_ptr m_stmt_setDocument_new; + std::shared_ptr m_stmt_setRevision; + std::shared_ptr m_stmt_setCursorPos; + std::shared_ptr m_stmt_setRow; }; -- cgit v1.2.3