ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
sqlite_context Class Referencefinal

SQLite database context for connection management. More...

#include <sqlite_context.hpp>

Collaboration diagram for sqlite_context:
Collaboration graph

Public Types

using connection_type = sqlgen::sqlite::Connection
 
using connection_ref = sqlgen::Ref< connection_type >
 

Public Member Functions

 sqlite_context (std::filesystem::path db_path)
 Construct context with database file path.
 
rfl::Result< connection_ref > connect () const
 Get a connection to the SQLite database.
 
const std::filesystem::path & db_path () const
 Get the database file path.
 
void initialize_schema ()
 Initialize the database schema if it doesn't exist.
 
void purge_all_data ()
 Delete all data from all tables.
 

Detailed Description

SQLite database context for connection management.

Provides a simple connection context for the local SQLite database that stores server environment bookmarks, folders, and tags.

Constructor & Destructor Documentation

◆ sqlite_context()

sqlite_context ( std::filesystem::path  db_path)
explicit

Construct context with database file path.

Parameters
db_pathPath to the SQLite database file.

Member Function Documentation

◆ connect()

rfl::Result< sqlite_context::connection_ref > connect ( ) const

Get a connection to the SQLite database.

Returns
Result containing the connection reference or an error.
Here is the caller graph for this function:

◆ purge_all_data()

void purge_all_data ( )

Delete all data from all tables.

Efficiently purges the database using bulk DELETE statements. Tables are deleted in order to respect foreign key constraints.

Here is the caller graph for this function: