Logo

Cake Planner

Backend

database.cpp

File Header Information

FieldValue
SPDX CommentNo description provided
SPDX TypeSOURCE
ContributorZHENG Robert
License IDMIT
Filedatabase.cpp
DescriptionNo description provided
Version0.15.0
Date2026-01-24
AuthorZHENG Robert (robert@hase-zheng.net)
CopyrightCopyright (c) 2026 ZHENG Robert
LicenseMIT

Table of Contents

API Documentation

DatabaseManager &DatabaseManager::instance()

Gets the singleton instance of the DatabaseManager.

Returns: Reference to the singleton instance.


void DatabaseManager::initialize(const QString &path)

Initializes the database manager.

ParameterDescription
pathThe file path to the SQLite database.

QSqlDatabase DatabaseManager::getDatabase()

Gets a thread-safe database connection.

Returns: A QSqlDatabase connection object.


QSqlQuery query(db)

Function implementation.


DatabaseManager::~DatabaseManager()

Destructor.


bool DatabaseManager::migrate()

Migrates the database schema.

Returns: True if migration succeeded, false otherwise.


CREATE INDEX IF NOT EXISTS idx_ratings_event_id ON ratings(event_id)

Function implementation.


CREATE INDEX IF NOT EXISTS idx_event_photos_event_id ON event_photos(event_id)

Function implementation.


CREATE INDEX IF NOT EXISTS idx_events_group_date ON events(group_id, event_date)

Function implementation.


QSqlQuery query(db)

Function implementation.


QSqlQuery checkQ(db)

Function implementation.