SQLite update event handling

This commit is contained in:
aleks-f
2013-02-10 22:27:16 -06:00
parent 4bcddad43e
commit 93c9e83e8d
4 changed files with 218 additions and 12 deletions

View File

@@ -65,14 +65,18 @@ int Utility::_threadMode =
SQLITE_CONFIG_MULTITHREAD;
#endif
const int Utility::OPERATION_INSERT = SQLITE_INSERT;
const int Utility::OPERATION_DELETE = SQLITE_DELETE;
const int Utility::OPERATION_UPDATE = SQLITE_UPDATE;
const std::string Utility::SQLITE_DATE_FORMAT = "%Y-%m-%d";
const std::string Utility::SQLITE_TIME_FORMAT = "%H:%M:%S";
Utility::TypeMap Utility::_types;
Poco::Mutex Utility::_mutex;
Utility::Utility()
{
Poco::FastMutex::ScopedLock l(_mutex);
Poco::Mutex::ScopedLock l(_mutex);
if (_types.empty())
{
@@ -299,4 +303,24 @@ bool Utility::setThreadMode(int mode)
}
void* Utility::eventHook(sqlite3* pDB, UpdateCallbackType callbackFn, void* pParam)
{
return sqlite3_update_hook(pDB, callbackFn, pParam);
}
void* Utility::eventHook(sqlite3* pDB, CommitCallbackType callbackFn, void* pParam)
{
return sqlite3_commit_hook(pDB, callbackFn, pParam);
}
void* Utility::eventHook(sqlite3* pDB, RollbackCallbackType callbackFn, void* pParam)
{
return sqlite3_rollback_hook(pDB, callbackFn, pParam);
}
} } } // namespace Poco::Data::SQLite