automotive-message-broker  0.14.803
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
sqlitedatabase.h
1 /*
2  * timedate - Displays time and date and daily events
3  * Copyright (c) <2009>, Intel Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU Lesser General Public License,
7  * version 2.1, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17  *
18  */
19 
20 #ifndef SQLITEDATABASE_H
21 #define SQLITEDATABASE_H
22 
23 #include <string>
24 #include <pthread.h>
25 #include <stdint.h>
26 #include <list>
27 
28 
29 struct SqliteDB
30 {
31  SqliteDB() : busy(false){}
32  void * db;
33  bool busy;
34 }; // struct SqliteDB
35 
37 {
38 public:
39  sqlitedatabase() {}
40  virtual ~sqlitedatabase();
41 
42  bool init(const std::string & d);
43 
44  virtual void setHost(const std::string &){}
45  virtual void setUser(const std::string &){}
46  virtual void setPassword(const std::string &){}
47  virtual void setDatabase(const std::string & db){database = db;}
48 
49  virtual void OnInit(SqliteDB *){}
50  virtual bool Connected();
51  virtual SqliteDB * grabdb();
52  virtual void freedb(SqliteDB * odb);
53 
54 protected:
55  SqliteDB *m_odb;
56  bool m_embedded;
57  std::string database;
58 };
59 
60 #endif
61