40#include "tkn_config.h"
53#include <tkdb_table.h>
59 static std::recursive_mutex& get_mutex() {
60 static std::recursive_mutex mutex;
70 sqlite3 * fDataBase =
nullptr;
71 std::map<tkstring,tkdb_table> fTables;
73 bool fReading =
false;
74 std::vector<tkstring> fViews;
75 std::map<tkstring, sqlite3_stmt*> fSQLStatement;
109 return fTables[_table];
122#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="")
virtual ~tkdatabase()=default
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....