11 typedef std::map<std::string, std::string> TUPLE;
12 typedef std::vector<TUPLE> TUPLES;
13 typedef std::vector<std::string> COLUMNS;
16 BASE_DB(std::string & dbHost,
17 std::string & dbDatabase,
19 std::string & dbPassword)
25 virtual ~BASE_DB() {};
27 void SetHost(const std::string & h) { host = h; };
28 void SetDatabase(const std::string & db) { database = db; };
29 void SetUser(const std::string & u) { user = u; };
30 void SetPassword(const std::string & p) { password = p; };
32 const std::string & GetHost() const { return host; };
33 const std::string & GetDatabase() const { return database; };
34 const std::string & GetUser() const { return user; };
35 const std::string & GetPassword() const { return password; };
37 const std::string & GetErrorMsg() const { return errorMsg; };
39 virtual bool Connect() { return true; };
40 virtual bool Disconnect() { return true; };
41 virtual bool Query(const std::string & q) { return true; };
42 virtual bool Start() { return true; };
43 virtual bool Commit() { return true; };
44 virtual bool Rollback() { return true; };
46 int GetTuples() const { return tuples; };
47 int GetColumns() const { return columns; };
48 int GetAffectedRows() const { return affected; };
50 virtual TUPLES GetResult() const { return TUPLES(); };
51 virtual TUPLE GetTuple(int n = 0) const { return TUPLE(); };
52 const COLUMNS & GetColumnsNames() const { return cols; };
69 extern "C" BASE_DB * CreateDriver();
70 extern "C" void DestroyDriver(BASE_DB *);
72 typedef BASE_DB * (* CreateDriverFn)();
73 typedef void (* DestroyDriverFn)(BASE_DB *);