mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-10-05 20:13:29 -04:00
Added serverDatabase library
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
// ======================================================================
|
||||
//
|
||||
// CreateCharacterCustomPersistStep.cpp
|
||||
// copyright (c) 2001 Sony Online Entertainment
|
||||
//
|
||||
// ======================================================================
|
||||
|
||||
#include "serverDatabase/FirstServerDatabase.h"
|
||||
#include "serverDatabase/CreateCharacterCustomPersistStep.h"
|
||||
|
||||
#include "serverDatabase/CharacterQueries.h"
|
||||
#include "serverDatabase/DatabaseProcess.h"
|
||||
#include "serverDatabase/DataLookup.h"
|
||||
#include "serverDatabase/Persister.h"
|
||||
#include "sharedDatabaseInterface/DbSession.h"
|
||||
#include "sharedLog/Log.h"
|
||||
|
||||
// ======================================================================
|
||||
|
||||
CreateCharacterCustomPersistStep::CreateCharacterCustomPersistStep(uint32 stationId, const NetworkId &characterObject, const Unicode::String &characterName, const std::string &normalizedName, int templateId, bool special) :
|
||||
m_stationId(stationId),
|
||||
m_characterObject(characterObject),
|
||||
m_characterName(characterName),
|
||||
m_normalizedName(normalizedName),
|
||||
m_templateId(templateId),
|
||||
m_clusterName(DatabaseProcess::getInstance().getClusterName()),
|
||||
m_special(special)
|
||||
{
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
CreateCharacterCustomPersistStep::~CreateCharacterCustomPersistStep()
|
||||
{
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
bool CreateCharacterCustomPersistStep::beforePersist(DB::Session *session)
|
||||
{
|
||||
UNREF(session);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
bool CreateCharacterCustomPersistStep::afterPersist(DB::Session *session)
|
||||
{
|
||||
// std::string characterName = Unicode::wideToNarrow(DatabaseProcess::getInstance().getNameByStationId(m_stationId));
|
||||
DBQuery::AddCharacter qry(m_stationId,m_characterObject, m_characterName, m_normalizedName);
|
||||
if (! (session->exec(&qry)))
|
||||
return false;
|
||||
qry.done();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void CreateCharacterCustomPersistStep::onComplete()
|
||||
{
|
||||
Persister::getInstance().onNewCharacterSaved(m_stationId,m_characterObject,m_characterName,m_templateId,m_special);
|
||||
DataLookup::getInstance().releaseName(m_stationId, NetworkId::cms_invalid);
|
||||
LOG("TraceCharacterCreation", ("%d CreateCharacterCustomPersistStep(%s) complete", m_stationId, Unicode::wideToNarrow(m_characterName).c_str()));
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
Reference in New Issue
Block a user