Lines Matching defs:database
38 #include "utils/sqlite/database.hpp"
45 /// Opens a database and defines session pragmas.
47 /// This auxiliary function ensures that, every time we open a SQLite database,
50 /// \param file The database file to be opened.
51 /// \param flags The flags for the open; see sqlite::database::open.
53 /// \return The opened database.
55 /// \throw store::error If there is a problem opening or creating the database.
56 sqlite::database
60 sqlite::database database = sqlite::database::open(file, flags);
61 database.exec("PRAGMA foreign_keys = ON");
62 return database;
71 /// The SQLite database this backend talks to.
72 sqlite::database database;
76 /// \param database_ The SQLite database instance.
77 /// \param metadata_ The metadata for the loaded database. This must match
81 /// \throw integrity_error If the schema in the database is too modern,
83 /// \throw old_schema_error If the schema in the database is older than our
86 impl(sqlite::database& database_, const metadata& metadata_) :
87 database(database_)
120 /// Opens a database in read-only mode.
122 /// \param file The database file to be opened.
126 /// \throw store::error If there is any problem opening the database.
130 sqlite::database db = detail::open_and_setup(file, sqlite::open_readonly);
135 /// Closes the SQLite database.
139 _pimpl->database.close();
143 /// Gets the connection to the SQLite database.
145 /// \return A database connection.
146 sqlite::database&
147 store::read_backend::database(void)
149 return _pimpl->database;