version 0.3.0
[fms.git] / src / db / sqlite3db.cpp
index edf2e8b..86a4f87 100644 (file)
@@ -30,8 +30,7 @@ const bool DB::Close()
 {\r
        if(IsOpen())\r
        {\r
-               //ZThread::Guard<ZThread::Mutex> g(m_mutex);\r
-               PThread::Guard g(m_mutex);\r
+               Poco::ScopedLock<Poco::FastMutex> g(m_mutex);\r
                m_lastresult=sqlite3_close(m_db);\r
                if(m_lastresult==SQLITE_OK)\r
                {\r
@@ -53,8 +52,7 @@ const bool DB::Execute(const std::string &sql)
 {\r
        if(IsOpen())\r
        {\r
-               //ZThread::Guard<ZThread::Mutex> g(m_mutex);\r
-               PThread::Guard g(m_mutex);\r
+               Poco::ScopedLock<Poco::FastMutex> g(m_mutex);\r
                m_lastresult=sqlite3_exec(m_db,sql.c_str(),NULL,NULL,NULL);\r
                if(m_lastresult==SQLITE_OK)\r
                {\r
@@ -75,8 +73,7 @@ const bool DB::ExecuteInsert(const std::string &sql, long &insertid)
 {\r
        if(IsOpen())\r
        {\r
-               //ZThread::Guard<ZThread::Mutex> g(m_mutex);\r
-               PThread::Guard g(m_mutex);\r
+               Poco::ScopedLock<Poco::FastMutex> g(m_mutex);\r
                m_lastresult=sqlite3_exec(m_db,sql.c_str(),NULL,NULL,NULL);\r
                if(m_lastresult==SQLITE_OK)\r
                {\r
@@ -98,8 +95,7 @@ const int DB::GetLastError(std::string &errormessage)
 {\r
        if(IsOpen())\r
        {\r
-               //ZThread::Guard<ZThread::Mutex> g(m_mutex);\r
-               PThread::Guard g(m_mutex);\r
+               Poco::ScopedLock<Poco::FastMutex> g(m_mutex);\r
                int errcode=sqlite3_errcode(m_db);\r
                const char *errmsg=sqlite3_errmsg(m_db);\r
                if(errmsg)\r
@@ -122,8 +118,7 @@ void DB::Initialize()
 \r
 const bool DB::IsOpen()\r
 {\r
-       //ZThread::Guard<ZThread::Mutex> g(m_mutex);\r
-       PThread::Guard g(m_mutex);\r
+       Poco::ScopedLock<Poco::FastMutex> g(m_mutex);\r
        return m_db ? true : false; \r
 }\r
 \r
@@ -135,8 +130,7 @@ const bool DB::Open(const std::string &filename)
        }\r
        if(IsOpen()==false)\r
        {\r
-               //ZThread::Guard<ZThread::Mutex> g(m_mutex);\r
-               PThread::Guard g(m_mutex);\r
+               Poco::ScopedLock<Poco::FastMutex> g(m_mutex);\r
                m_lastresult=sqlite3_open(filename.c_str(),&m_db);\r
                if(m_lastresult==SQLITE_OK)\r
                {\r
@@ -157,8 +151,7 @@ Statement DB::Prepare(const std::string &sql)
 {\r
        if(IsOpen())\r
        {\r
-               //ZThread::Guard<ZThread::Mutex> g(m_mutex);\r
-               PThread::Guard g(m_mutex);\r
+               Poco::ScopedLock<Poco::FastMutex> g(m_mutex);\r
                sqlite3_stmt *statement=NULL;\r
                m_lastresult=sqlite3_prepare_v2(m_db,sql.c_str(),sql.size(),&statement,NULL);\r
                if(m_lastresult==SQLITE_OK)\r
@@ -180,8 +173,7 @@ Recordset DB::Query(const std::string &sql)
 {\r
        if(IsOpen())\r
        {\r
-               //ZThread::Guard<ZThread::Mutex> g(m_mutex);\r
-               PThread::Guard g(m_mutex);\r
+               Poco::ScopedLock<Poco::FastMutex> g(m_mutex);\r
                char **rs=NULL;\r
                int rows,cols;\r
                m_lastresult=sqlite3_get_table(m_db,sql.c_str(),&rs,&rows,&cols,NULL);\r
@@ -205,8 +197,7 @@ const int DB::SetBusyTimeout(const int ms)
 {\r
        if(IsOpen())\r
        {\r
-               //ZThread::Guard<ZThread::Mutex> g(m_mutex);\r
-               PThread::Guard g(m_mutex);\r
+               Poco::ScopedLock<Poco::FastMutex> g(m_mutex);\r
                m_lastresult=sqlite3_busy_timeout(m_db,ms);\r
                return m_lastresult;\r
        }\r