00001 /* 00002 * Database.h 00003 * 00004 * Created on: Nov 2, 2011 00005 * Author: martin 00006 */ 00007 00008 #ifndef DATABASE_H_ 00009 #define DATABASE_H_ 00010 00011 #include <string> 00012 #include <sqlite3.h> 00013 #include <set> 00014 00015 namespace sqlite 00016 { 00017 00018 class Statement; 00019 00025 class Database 00026 { 00027 public: 00032 Database(std::string const& filename); 00033 virtual ~Database(); 00034 Database& operator=(Database const&) = delete; 00035 Database(Database const&) = delete; 00036 Database& operator=(Database && other); 00037 Database(Database && other); 00041 void close(); 00045 void force_close() throw(); 00051 void register_statement(Statement& st); 00057 void unregister_statement(Statement& st); 00062 int unfinalized(); 00063 00068 bool is_new(); 00069 00070 sqlite3* const& cobj(); 00071 private: 00072 sqlite3* conn; 00073 std::set<Statement*> stmts; 00074 bool is_nw; 00075 }; 00076 } 00077 #endif /* DATABASE_H_ */