DB Layer:
- Make SQL Transactions actual objects used in code. (Thanks to Derex for the idea) * Uncommitted transactions will be automatically rolled back and cleaned up using ACE_Refcounted_Auto_Ptr, so no need to call Rollback() in the code. * Prevents recursive transactions and makes developers aware of transactions going on. * Gets rid of unneccesary overhead iterating over a concurrent map. - Some cleanups in affected code, including better usage of transaction control in AH / mail related code to prevent data loss. *** Experimental, use at own risk, recommended to backup your DBs. *** --HG-- branch : trunk
This commit is contained in:
@@ -2395,8 +2395,12 @@ bool ChatHandler::HandleSendMailCommand(const char* args)
|
||||
// from console show not existed sender
|
||||
MailSender sender(MAIL_NORMAL,m_session ? m_session->GetPlayer()->GetGUIDLow() : 0, MAIL_STATIONERY_GM);
|
||||
|
||||
//- TODO: Fix poor design
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
MailDraft(subject, text)
|
||||
.SendMailTo(MailReceiver(target,GUID_LOPART(target_guid)),sender);
|
||||
.SendMailTo(trans, MailReceiver(target,GUID_LOPART(target_guid)),sender);
|
||||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
std::string nameLink = playerLink(target_name);
|
||||
PSendSysMessage(LANG_MAIL_SENT, nameLink.c_str());
|
||||
|
||||
Reference in New Issue
Block a user