implement multi-table struct model

This commit is contained in:
yggverse 2024-09-11 00:29:47 +03:00
parent 5f910bf81b
commit b3635c77bc
4 changed files with 65 additions and 59 deletions

View file

@ -24,7 +24,7 @@ Page::Page(
action__refresh = ACTION__REFRESH;
// Init database
DB::init(
DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::init(
this->db = db
);
@ -74,7 +74,7 @@ int Page::save(
) {
// Delegate save action to child components
return pageNavigation->save(
Page::DB::add(
Page::DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::add(
db,
DB__APP_BROWSER_MAIN_TAB__SESSION_ID,
mime,
@ -364,7 +364,7 @@ void Page::set_navbar_request_text(
}
// Database model
int Page::DB::init(
int Page::DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::init(
sqlite3 * db
) {
char * error;
@ -387,7 +387,7 @@ int Page::DB::init(
);
}
int Page::DB::clear(
int Page::DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::clear(
sqlite3 * db,
const int & DB__APP_BROWSER_MAIN_TAB__SESSION_ID
) {
@ -440,7 +440,7 @@ int Page::DB::clear(
);
}
sqlite3_int64 Page::DB::add(
sqlite3_int64 Page::DB::APP_BROWSER_MAIN_TAB_PAGE__SESSION::add(
sqlite3 * db,
const sqlite3_int64 & DB__APP_BROWSER_MAIN_TAB__SESSION_ID,
const Page::MIME & MIME,

View file

@ -37,31 +37,34 @@ namespace app::browser::main::tab
struct DB
{
enum APP_BROWSER_MAIN_TAB_PAGE__SESSION
struct APP_BROWSER_MAIN_TAB_PAGE__SESSION
{
ID,
TIME,
MIME,
TITLE,
DESCRIPTION
enum
{
ID,
TIME,
MIME,
TITLE,
DESCRIPTION
};
static int init(
sqlite3 * db
);
static int clear(
sqlite3 * db,
const int & DB__APP_BROWSER_MAIN_TAB__SESSION_ID
);
static sqlite3_int64 add(
sqlite3 * db,
const sqlite3_int64 & DB__APP_BROWSER_MAIN_TAB__SESSION_ID,
const Page::MIME & MIME,
const Glib::ustring & TITLE,
const Glib::ustring & DESCRIPTION
);
};
static int init(
sqlite3 * db
);
static int clear(
sqlite3 * db,
const int & DB__APP_BROWSER_MAIN_TAB__SESSION_ID
);
static sqlite3_int64 add(
sqlite3 * db,
const sqlite3_int64 & DB__APP_BROWSER_MAIN_TAB__SESSION_ID,
const Page::MIME & MIME,
const Glib::ustring & TITLE,
const Glib::ustring & DESCRIPTION
);
};
private: