Use ´manual´ ACE_Thread_Mutex objects in SQLTransaction class instead of using ACE_Based::LockedQueue.

This will either result in a crash fix caused by underlying operations of ACE_Based::LockedQueue, or at least give us a clearer view at where the crash is coming from.

--HG--
branch : trunk
This commit is contained in:
Machiavelli
2010-05-26 19:19:06 +02:00
parent 6da6879eff
commit 7c0f140bb0
2 changed files with 23 additions and 13 deletions

View File

@@ -35,35 +35,38 @@ void SqlTransaction::Execute(Database *db)
{
const char* sql;
m_Mutex.acquire();
if (m_queue.empty())
{
m_Mutex.release();
return;
}
db->DirectExecute("START TRANSACTION");
while (!m_queue.empty())
{
sql = m_queue.peek();
m_queue.unlock();
sql = m_queue.front();
if (!db->DirectExecute(sql))
{
free((void*)const_cast<char*>(sql));
m_queue.pop_front();
m_queue.pop();
db->DirectExecute("ROLLBACK");
while (!m_queue.empty())
{
sql = m_queue.peek();
m_queue.unlock();
free((void*)const_cast<char*>(sql));
m_queue.pop_front();
free((void*)const_cast<char*>(m_queue.front()));
m_queue.pop();
}
m_Mutex.release();
return;
}
free((void*)const_cast<char*>(sql));
m_queue.pop_front();
m_queue.pop();
}
db->DirectExecute("COMMIT");
m_Mutex.release();
}
/// ---- ASYNC QUERIES ----