mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 02:46:33 +01:00
Revert revision: 053bfe8ad9, this cause some crash.
Use dynamic_cast more is safer. I think no more crash on db code. --HG-- branch : trunk
This commit is contained in:
@@ -33,17 +33,23 @@ void SqlStatement::Execute(Database *db)
|
||||
|
||||
void SqlTransaction::Execute(Database *db)
|
||||
{
|
||||
const char *sql;
|
||||
if (m_queue.empty())
|
||||
return;
|
||||
|
||||
db->DirectExecute("START TRANSACTION");
|
||||
while(m_queue.next(sql))
|
||||
while(!m_queue.empty())
|
||||
{
|
||||
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.next(sql))
|
||||
while(!m_queue.empty())
|
||||
{
|
||||
free((void*)const_cast<char*>(sql));
|
||||
free((void*)const_cast<char*>(m_queue.front()));
|
||||
m_queue.pop();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user