Lines Matching full:database

29 #include "utils/sqlite/database.hpp"
55 /// Internal implementation for sqlite::database.
56 struct utils::sqlite::database::impl : utils::noncopyable {
57 /// Path to the database as seen at construction time.
60 /// The SQLite 3 internal database.
63 /// Whether we own the database or not (to decide if we close it).
68 /// \param db_filename_ The path to the database as seen at construction
73 /// \param db_ The SQLite internal database.
97 /// \param file The path to the database file to be opened.
100 /// \return The opened database.
103 /// database.
104 /// \throw api_error If there is any problem opening the database.
114 sqlite::database error_db(utils::make_optional(fs::path(file)), in safe_open()
131 // not be trying to close a busy database in our code. Maybe revisit in close()
139 /// Initializes the SQLite database.
141 /// You must share the same database object alongside the lifetime of your
145 /// \param db_filename_ The path to the database as seen at construction
149 sqlite::database::database( in database() function in sqlite::database
157 /// Destructor for the SQLite 3 database.
162 sqlite::database::~database(void) in ~database()
167 /// Opens a memory-based temporary SQLite database.
169 /// \return An in-memory database instance.
171 /// \throw std::bad_alloc If there is not enough memory to open the database.
172 /// \throw api_error If there is any problem opening the database.
173 sqlite::database
174 sqlite::database::in_memory(void) in in_memory()
176 return database(none, impl::safe_open(":memory:", SQLITE_OPEN_READWRITE), in in_memory()
181 /// Opens a named on-disk SQLite database.
183 /// \param file The path to the database file to be opened. This does not
188 /// \return A file-backed database instance.
190 /// \throw std::bad_alloc If there is not enough memory to open the database.
191 /// \throw api_error If there is any problem opening the database.
192 sqlite::database
193 sqlite::database::open(const fs::path& file, int open_flags) in open()
195 PRE_MSG(!file.str().empty(), "Use database::temporary() instead"); in open()
196 PRE_MSG(file.str() != ":memory:", "Use database::in_memory() instead"); in open()
213 return database(utils::make_optional(file), in open()
218 /// Opens an unnamed on-disk SQLite database.
220 /// \return A file-backed database instance.
222 /// \throw std::bad_alloc If there is not enough memory to open the database.
223 /// \throw api_error If there is any problem opening the database.
224 sqlite::database
225 sqlite::database::temporary(void) in temporary()
227 return database(none, impl::safe_open("", SQLITE_OPEN_READWRITE), true); in temporary()
233 /// \return The raw SQLite 3 database. This is returned as a void pointer to
238 sqlite::database::raw_database(void) in raw_database()
244 /// Terminates the connection to the database.
251 sqlite::database::close(void) in close()
257 /// Returns the path to the connected database.
259 /// It is OK to call this function on a live database object, even after close()
262 /// \return The path to the file that matches the connected database or none if
263 /// the connection points to a transient database.
265 sqlite::database::db_filename(void) const in db_filename()
276 /// tables in a database and in tests.
282 sqlite::database::exec(const std::string& sql) in exec()
296 sqlite::database::begin_transaction(void) in begin_transaction()
309 sqlite::database::create_statement(const std::string& sql) in create_statement()
325 sqlite::database::last_insert_rowid(void) in last_insert_rowid()