From afed9ccfadc24a6a58da781cfe7eb5d1a4e4f7c3 Mon Sep 17 00:00:00 2001 From: Ben Radford Date: Tue, 16 May 2023 13:57:56 +0100 Subject: [PATCH] Add enum for intended sqlite database open modes. --- src/libstore/sqlite.hh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/libstore/sqlite.hh b/src/libstore/sqlite.hh index 6e14852cb..8f4bc49a8 100644 --- a/src/libstore/sqlite.hh +++ b/src/libstore/sqlite.hh @@ -11,6 +11,24 @@ struct sqlite3_stmt; namespace nix { +enum class SQLiteOpenMode { + /** + * Open the database in read-write mode. + * If the database does not exist, it will be created. + */ + Normal, + /** + * Open the database in read-write mode. + * Fails with an error if the database does not exist. + */ + NoCreate, + /** + * Open the database in read-only mode. + * Fails with an error if the database does not exist. + */ + ReadOnly +}; + /** * RAII wrapper to close a SQLite database automatically. */