Use recursive thread mutex for SQL transaction queue

--HG--
branch : trunk
This commit is contained in:
thenecromancer
2010-02-01 10:23:18 +01:00
parent adfce8fec4
commit fd5f1e554d
2 changed files with 9 additions and 11 deletions

View File

@@ -33,22 +33,17 @@ void SqlStatement::Execute(Database *db)
void SqlTransaction::Execute(Database *db)
{
if(m_queue.empty())
return;
const char *sql;
db->DirectExecute("START TRANSACTION");
while(!m_queue.empty())
while(m_queue.next(sql))
{
char const *sql = m_queue.front();
m_queue.pop();
if(!db->DirectExecute(sql))
{
free((void*)const_cast<char*>(sql));
db->DirectExecute("ROLLBACK");
while(!m_queue.empty())
while(m_queue.next(sql))
{
free((void*)const_cast<char*>(m_queue.front()));
m_queue.pop();
free((void*)const_cast<char*>(sql));
}
return;
}