projects
/
fms.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
version 0.3.29
[fms.git]
/
include
/
option.h
diff --git
a/include/option.h
b/include/option.h
index
c18c716
..
c0dff16
100644
(file)
--- a/
include/option.h
+++ b/
include/option.h
@@
-1,17
+1,18
@@
#ifndef _option_
\r
#define _option_
\r
\r
#ifndef _option_
\r
#define _option_
\r
\r
-#include "
db/sqlite3db
.h"
\r
+#include "
idatabase
.h"
\r
\r
#include <sstream>
\r
\r
#include <sstream>
\r
-//#include <zthread/Singleton.h>
\r
-#include "pthreadwrapper/singleton.h"
\r
\r
//just a wrapper around the database for the options table
\r
\r
//just a wrapper around the database for the options table
\r
-class Option:public
PThread::Singleton<Option>
\r
+class Option:public
IDatabase
\r
{
\r
public:
\r
{
\r
public:
\r
+ Option(SQLite3DB::DB *db):IDatabase(db) {}
\r
+
\r
const bool Get(const std::string &option, std::string &value);
\r
const bool Get(const std::string &option, std::string &value);
\r
+ const bool GetInt(const std::string &option, int &value);
\r
template<class T>
\r
void Set(const std::string &option, const T &value);
\r
private:
\r
template<class T>
\r
void Set(const std::string &option, const T &value);
\r
private:
\r
@@
-26,14
+27,14
@@
void Option::Set(const std::string &option, const T &value)
std::string tempval;
\r
if(Get(option,tempval)==true)
\r
{
\r
std::string tempval;
\r
if(Get(option,tempval)==true)
\r
{
\r
- SQLite3DB::Statement st=
SQLite3DB::DB::Instance()
->Prepare("UPDATE tblOption SET OptionValue=? WHERE Option=?;");
\r
+ SQLite3DB::Statement st=
m_db
->Prepare("UPDATE tblOption SET OptionValue=? WHERE Option=?;");
\r
st.Bind(0,valuestr.str());
\r
st.Bind(1,option);
\r
st.Step();
\r
}
\r
else
\r
{
\r
st.Bind(0,valuestr.str());
\r
st.Bind(1,option);
\r
st.Step();
\r
}
\r
else
\r
{
\r
- SQLite3DB::Statement st=
SQLite3DB::DB::Instance()
->Prepare("INSERT INTO tblOption(Option,OptionValue) VALUES(?,?);");
\r
+ SQLite3DB::Statement st=
m_db
->Prepare("INSERT INTO tblOption(Option,OptionValue) VALUES(?,?);");
\r
st.Bind(0,option);
\r
st.Bind(1,valuestr.str());
\r
st.Step();
\r
st.Bind(0,option);
\r
st.Bind(1,valuestr.str());
\r
st.Step();
\r