6 #include <TSQLServer.h>
20 std::vector<std::string> m_name;
21 std::vector<std::string> m_type;
22 std::vector<bool> m_is_key;
24 unsigned int Size()
const {
return m_name.size(); }
25 void Add(
const std::string name,
const std::string type,
const bool is_key=
false);
26 void Get(
const int idx, std::string& name, std::string& type,
bool& is_key)
const;
30 explicit DbSvc(
const SvrId_t svr_id, std::string dbfile);
33 void UseSchema(
const char* name,
const bool do_create=
false,
const bool do_drop=
false);
34 void UseSchema(
const std::string name,
const bool do_create=
false,
const bool do_drop=
false) {
UseSchema(name.c_str(), do_create, do_drop); }
38 bool HasTable(
const char* name,
const bool exit_on_false=
false);
39 bool HasTable(
const std::string name,
const bool exit_on_false=
false) {
return HasTable(name.c_str(), exit_on_false); }
40 void CreateTable(
const std::string name,
const std::vector<std::string> list_var,
const std::vector<std::string> list_type,
const std::vector<std::string> list_key);
41 void CreateTable(
const std::string name,
const int n_var,
const char** list_var,
const char** list_type,
const int n_key=0,
const char** list_key=0);
42 void CreateTable(
const std::string name,
const VarList list);
44 TSQLServer*
Con() {
return m_con; }
45 TSQLStatement*
Process(
const char* query);
46 TSQLStatement*
Process(
const std::string query) {
return Process(query.c_str()); }
58 bool FileExist(
const std::string fileName);
59 std::string ExpandEnvironmentals(
const std::string& input );
void Get(const int idx, std::string &name, std::string &type, bool &is_key) const
void Add(const std::string name, const std::string type, const bool is_key=false)
unsigned int Size() const
Standard interface with SQL database.
void UseSchema(const std::string name, const bool do_create=false, const bool do_drop=false)
DbSvc(const SvrId_t svr_id=AutoSvr, const UsrId_t usr_id=AutoUsr, const std::string my_cnf="")
TSQLStatement * Process(const char *query)
void DropTable(const char *name)
void UseSchema(const char *name, const bool do_create=false, const bool do_drop=false)
TSQLStatement * Process(const std::string query)
void CreateTable(const std::string name, const std::vector< std::string > list_var, const std::vector< std::string > list_type, const std::vector< std::string > list_key)
bool HasTable(const std::string name, const bool exit_on_false=false)
void DropTable(const std::string name)
bool HasTable(const char *name, const bool exit_on_false=false)