#ifndef _Protect_ProtectDB_h_ #define _Protect_ProtectDB_h_ #include #ifndef flagUSE_SQLITE #include #else #include #endif NAMESPACE_UPP #ifndef flagUSE_SQLITE #define SCHEMADIALECT #else #define SCHEMADIALECT #endif #define MODEL #include "Sql/sch_header.h" // encapsulation of Protect database class ProtectDB { private: // host, db name, username and password String host; String dbName; String userName; String password; // connected flag bool connected; // database upgraded flag bool upgraded; // database session #ifndef flagUSE_SQLITE MySqlSession session; #else Sqlite3Session session; #endif protected: public: ProtectDB(); ~ProtectDB(); // setting of connection data ProtectDB &SetHost(String const &_host) { host = _host; return *this; } ProtectDB &SetDBName(String const &_dbName) { dbName = _dbName; return *this; } ProtectDB &SetUserName(String const &_name) { userName = _name; return *this; } ProtectDB &SetPassword(String const &_pwd) { password = _pwd; return *this; } // connect/disconnect bool Connect(void); bool Disconnect(void); bool IsConnected(void) { return connected; } // refresh connection bool RefreshConnection(void); // get data -- email is the key -- non repeatable VectorMapGet(String const &mail); // set/append data bool Set(VectorMap const &data); // get default record VectorMap Default(VectorMap const &base = VectorMap()); // network adapter MAC checkings -- if enabled, avoid multiple demo // registrations with different mails on same machine(s) Vector GetMACEMails(String const &mac); bool UpdateMac(String const &mac, Vector const &eMails); }; END_UPP_NAMESPACE #endif