Exemplo n.º 1
0
void SqlDelayThread::run()
{
    #ifndef DO_POSTGRESQL
    mysql_thread_init();
    #endif

    const uint32 loopSleepms = 10;

    const uint32 pingEveryLoop = m_dbEngine->GetPingIntervall()/loopSleepms;

    uint32 loopCounter = 0;
    while (m_running)
    {
        // if the running state gets turned off while sleeping
        // empty the queue before exiting

        ACE_Based::Thread::Sleep(loopSleepms);
        SqlOperation* s;
        while (m_sqlQueue.next(s))
        {
            s->Execute(m_dbEngine);
            delete s;
        }
        if((loopCounter++) >= pingEveryLoop)
        {
            loopCounter = 0;
            delete m_dbEngine->Query("SELECT 1");
        }
    }

    #ifndef DO_POSTGRESQL
    mysql_thread_end();
    #endif
}
Exemplo n.º 2
0
void SqlDelayThread::run()
{
    SqlOperation* s;
    #ifndef DO_POSTGRESQL
    mysql_thread_init();
    #endif

    while (m_running)
    {
      try
	{
	  s = m_sqlQueue.next();
	}
      catch(...)
	{continue;}
      if(!s)
	continue;
      s->Execute(m_dbEngine);
      delete s;
    }

    #ifndef DO_POSTGRESQL
    mysql_thread_end();
    #endif
}
Exemplo n.º 3
0
void SqlDelayThread::ProcessRequests()
{
    SqlOperation* s = NULL;
    while (m_sqlQueue.next(s))
    {
        s->Execute(m_dbConnection);
        delete s;
    }
}
Exemplo n.º 4
0
bool SqlTransaction::Execute(SqlConnection *conn)
{
    if (m_queue.empty())
        return true;

    LOCK_DB_CONN(conn);

    conn->BeginTransaction();

    const int nItems = m_queue.size();
    for (int i = 0; i < nItems; ++i)
    {
        SqlOperation * pStmt = m_queue[i];
        if(!pStmt->Execute(conn))
        {
            conn->RollbackTransaction();
            return false;
        }
    }

    return conn->CommitTransaction();
}
Exemplo n.º 5
0
void SqlDelayThread::run()
{
    #ifndef DO_POSTGRESQL
    mysql_thread_init();
    #endif

    while (m_running)
    {
        // if the running state gets turned off while sleeping
        // empty the queue before exiting
        ACE_Based::Thread::Sleep(10);
        SqlOperation* s;
        while (m_sqlQueue.next(s))
        {
            s->Execute(m_dbEngine);
            delete s;
        }
    }

    #ifndef DO_POSTGRESQL
    mysql_thread_end();
    #endif
}