Implement support for updating the program_end_time column

fixes #6923
This commit is contained in:
Gunnar Beutner 2015-02-04 15:25:10 +01:00
parent e3dcc8a610
commit 1a23ae94f9
6 changed files with 32 additions and 4 deletions

View File

@ -81,6 +81,21 @@ void DbConnection::Pause(void)
<< "Pausing IDO connection: " << GetName();
m_CleanUpTimer.reset();
DbQuery query1;
query1.Table = "programstatus";
query1.IdColumn = "programstatus_id";
query1.Type = DbQueryUpdate;
query1.Category = DbCatProgramStatus;
query1.WhereCriteria = new Dictionary();
query1.WhereCriteria->Set("instance_id", 0); /* DbConnection class fills in real ID */
query1.Fields = new Dictionary();
query1.Fields->Set("instance_id", 0); /* DbConnection class fills in real ID */
query1.Fields->Set("program_end_time", DbValue::FromTimestamp(Utility::GetTime()));
ExecuteQuery(query1);
NewTransaction();
}
void DbConnection::InitializeDbTimer(void)

View File

@ -78,6 +78,7 @@ protected:
virtual void CleanUpExecuteQuery(const String& table, const String& time_column, double max_age);
virtual void FillIDCache(const DbType::Ptr& type) = 0;
virtual void NewTransaction(void) = 0;
void UpdateAllObjects(void);

View File

@ -135,10 +135,15 @@ void IdoMysqlConnection::Disconnect(void)
void IdoMysqlConnection::TxTimerHandler(void)
{
m_QueryQueue.Enqueue(boost::bind(&IdoMysqlConnection::NewTransaction, this), true);
NewTransaction();
}
void IdoMysqlConnection::NewTransaction(void)
{
m_QueryQueue.Enqueue(boost::bind(&IdoMysqlConnection::InternalNewTransaction, this));
}
void IdoMysqlConnection::InternalNewTransaction(void)
{
boost::mutex::scoped_lock lock(m_ConnectionMutex);

View File

@ -55,6 +55,7 @@ protected:
virtual void ExecuteQuery(const DbQuery& query);
virtual void CleanUpExecuteQuery(const String& table, const String& time_key, double time_value);
virtual void FillIDCache(const DbType::Ptr& type);
virtual void NewTransaction(void);
private:
DbReference m_InstanceID;
@ -80,7 +81,6 @@ private:
void InternalActivateObject(const DbObject::Ptr& dbobj);
void Disconnect(void);
void NewTransaction(void);
void Reconnect(void);
void AssertOnWorkQueue(void);
@ -90,6 +90,7 @@ private:
void InternalExecuteQuery(const DbQuery& query, DbQueryType *typeOverride = NULL);
void InternalCleanUpExecuteQuery(const String& table, const String& time_key, double time_value);
void InternalNewTransaction(void);
virtual void ClearConfigTable(const String& table);

View File

@ -136,10 +136,15 @@ void IdoPgsqlConnection::Disconnect(void)
void IdoPgsqlConnection::TxTimerHandler(void)
{
m_QueryQueue.Enqueue(boost::bind(&IdoPgsqlConnection::NewTransaction, this), true);
NewTransaction();
}
void IdoPgsqlConnection::NewTransaction(void)
{
m_QueryQueue.Enqueue(boost::bind(&IdoPgsqlConnection::NewTransaction, this), true);
}
void IdoPgsqlConnection::InternalNewTransaction(void)
{
boost::mutex::scoped_lock lock(m_ConnectionMutex);

View File

@ -55,6 +55,7 @@ protected:
virtual void ExecuteQuery(const DbQuery& query);
virtual void CleanUpExecuteQuery(const String& table, const String& time_key, double time_value);
virtual void FillIDCache(const DbType::Ptr& type);
virtual void NewTransaction(void);
private:
DbReference m_InstanceID;
@ -78,7 +79,7 @@ private:
void InternalActivateObject(const DbObject::Ptr& dbobj);
void Disconnect(void);
void NewTransaction(void);
void InternalNewTransaction(void);
void Reconnect(void);
void AssertOnWorkQueue(void);