17#include "tkn_config.h"
30#include <tkdb_table.h>
36 static std::recursive_mutex &get_mutex()
38 static std::recursive_mutex mutex;
48 sqlite3 *fDataBase =
nullptr;
49 std::map<tkstring, tkdb_table> fTables;
51 bool fReading =
false;
52 std::vector<tkstring> fViews;
53 std::map<tkstring, sqlite3_stmt *> fSQLStatement;
61 void set_sql_db(sqlite3 *_sql_db) { fDataBase = _sql_db; }
75 std::vector<tkstring> &
get_views() {
return fViews; }
88 return fTables[_table];
101#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....