00001 #ifndef s11n_net_SQLITE3X_SETTINGS_DB_INCLUDED
00002 #define s11n_net_SQLITE3X_SETTINGS_DB_INCLUDED 1
00003
00004 #include "sqlite3x.hpp"
00005
00006 namespace sqlite3x {
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 class settings_db
00027 {
00028 public:
00029
00030
00031
00032
00033 explicit settings_db( std::string const & dbname );
00034
00035
00036
00037
00038 settings_db();
00039
00040
00041
00042 ~settings_db();
00043
00044
00045
00046 bool is_open() const;
00047
00048
00049
00050 void clear();
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061 void clear( std::string const & where );
00062
00063
00064
00065
00066 void set( std::string const & key, int val );
00067
00068
00069
00070 void set( std::string const & key, sqlite_int64 val );
00071
00072
00073
00074 void set( std::string const & key, bool val );
00075
00076
00077
00078 void set( std::string const & key, double val );
00079
00080
00081
00082 void set( std::string const & key, std::string const & val );
00083
00084
00085
00086 void set( std::string const & key, char const * val );
00087
00088
00089
00090
00091
00092
00093
00094 bool get( std::string const & key, int & val );
00095
00096 bool get( std::string const & key, sqlite_int64 & val );
00097
00098 bool get( std::string const & key, bool & val );
00099
00100 bool get( std::string const & key, double & val );
00101
00102 bool get( std::string const & key, std::string & val );
00103
00104
00105
00106
00107 void open( std::string const & dbname );
00108
00109
00110
00111
00112 void close();
00113
00114
00115
00116
00117
00118
00119 sqlite3_connection * db();
00120 private:
00121 void init();
00122 sqlite3_connection * m_db;
00123 };
00124
00125 }
00126
00127
00128 #endif // s11n_net_SQLITE3X_SETTINGS_DB_INCLUDED