{\r
if(IsOpen())\r
{\r
- ZThread::Guard<ZThread::Mutex> 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
{\r
if(IsOpen())\r
{\r
- ZThread::Guard<ZThread::Mutex> 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
{\r
if(IsOpen())\r
{\r
- ZThread::Guard<ZThread::Mutex> 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
{\r
if(IsOpen())\r
{\r
- ZThread::Guard<ZThread::Mutex> 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
\r
const bool DB::IsOpen()\r
{\r
- ZThread::Guard<ZThread::Mutex> g(m_mutex);\r
+ Poco::ScopedLock<Poco::FastMutex> g(m_mutex);\r
return m_db ? true : false; \r
}\r
\r
const bool DB::Open(const std::string &filename)\r
{\r
- if(IsOpen()==false)\r
+ if(IsOpen()==true)\r
{\r
Close(); \r
}\r
if(IsOpen()==false)\r
{\r
- ZThread::Guard<ZThread::Mutex> 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
{\r
if(IsOpen())\r
{\r
- ZThread::Guard<ZThread::Mutex> 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
{\r
if(IsOpen())\r
{\r
- ZThread::Guard<ZThread::Mutex> 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
{\r
if(IsOpen())\r
{\r
- ZThread::Guard<ZThread::Mutex> 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
+ else\r
+ {\r
+ return SQLITE_ERROR;\r
+ }\r
}\r
\r
} // namespace\r