17#include "tkn_config.h"
26#include "tkn_sqlite3.h"
29#include <tkdb_table.h>
44 sqlite3 *fDataBase =
nullptr;
45 std::map<tkstring, tkdb_table> fTables;
47 bool fReading =
false;
48 std::vector<tkstring> fViews;
49 std::map<tkstring, sqlite3_stmt *> fSQLStatement;
50 std::map<tkstring, std::vector<std::vector<tkdb_column *>>> fSQLColumnBindings;
58 void set_sql_db(sqlite3 *_sql_db) { fDataBase = _sql_db; }
72 std::vector<tkstring> &
get_views() {
return fViews; }
85 return fTables[_table];
98#define gdatabase (tkn::tkdatabase::the_database())
Interface to the sqlite database.
int count(const tkstring &_from, const tkstring &_condition="")
resets column values and ends the select statement
void end(const tkstring &_loop_name="default")
reads the next entry coresponding to the select statement and fills columns
void remove_table(tkstring _table_name)
static void list_files(tkstring _dir, tkstring _pattern)
void add_table(tkdb_table &_table)
void begin(tkstring _selection, tkstring _from, tkstring _condition="", tkstring _loop_name="default", tkstring _extra_cmd="")
tkstring get_value(tkstring _selection, tkstring _from, tkstring _condition="")
tkdb_table & new_table(tkstring _table_name)
void set_sql_db(sqlite3 *_sql_db)
sqlite3 * open(tkstring _db, tkstring _option="OPEN")
bool has_view(const tkstring &_table_name)
tkdatabase(bool opening_db=true)
void print(const tkstring &_properties="", const tkstring &_opt="")
int exec_sql(const char *_cmd)
returns the first value for selection
static int getdir(tkstring _dir, std::vector< tkstring > &_files)
bool has_table(const tkstring &_table_name)
tkdb_table * get_table(tkstring _table_name)
bool next(const tkstring &_loop_name="default")
executes the select statement
std::vector< tkstring > & get_views()
tkdb_table & operator[](const char *_table)
static tkdatabase * the_database()
Representaiton of a sqlite data table.
std::string with usefull tricks from TString (ROOT) and KVString (KaliVeda) and more....