A TUI to monitor YouTube channels
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

27 lines
794 B

// SPDX-License-Identifier: MIT
#pragma once
#include <map>
#include <sqlite3.h>
#include <string>
extern sqlite3 *db;
extern void tui_abort(const char *fmt, ...);
#define SC(x) { const int res = (x); if(res != SQLITE_OK && res != SQLITE_ROW && res != SQLITE_DONE) { tui_abort("Database error:\n%s failed: (%d) %s", #x, res, sqlite3_errstr(res)); }}
class db_transaction {
public:
db_transaction();
~db_transaction();
};
std::string get_string(sqlite3_stmt *row, int col);
int get_int(sqlite3_stmt *row, int col);
void db_init(const std::string &filename);
void db_shutdown();
std::string db_get_setting(const std::string &key);
void db_set_setting(const std::string &key, const std::string &value);
std::map<std::string, std::string> db_get_settings(const std::string &prefix);