mirror of
https://github.com/SWG-Source/src.git
synced 2026-07-14 23:07:48 -04:00
first try at nesting code, minus the actual insert
This commit is contained in:
@@ -50,6 +50,8 @@ set(SHARED_SOURCES
|
||||
shared/TaskGetClusterList.h
|
||||
shared/TaskGetValidationData.cpp
|
||||
shared/TaskGetValidationData.h
|
||||
shared/TaskMapAccount.h
|
||||
shared/TaskMapAccount.cpp
|
||||
shared/TaskRegisterNewCluster.cpp
|
||||
shared/TaskRegisterNewCluster.h
|
||||
shared/TaskRenameCharacter.cpp
|
||||
@@ -76,7 +78,7 @@ if(WIN32)
|
||||
else()
|
||||
set(PLATFORM_SOURCES
|
||||
linux/main.cpp
|
||||
)
|
||||
shared/TaskMapAccount.h shared/TaskMapAccount.cpp)
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
#include "Archive/ByteStream.h"
|
||||
#include "ConfigLoginServer.h"
|
||||
#include "DatabaseConnection.h"
|
||||
#include "LoginServer.h"
|
||||
#include "SessionApiClient.h"
|
||||
#include "TaskMapAccount.h"
|
||||
#include "serverKeyShare/KeyShare.h"
|
||||
#include "sharedFoundation/ApplicationVersion.h"
|
||||
#include "sharedLog/Log.h"
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#include "sharedFoundation/CrcConstexpr.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
//#include <algorithm>
|
||||
|
||||
#include "webAPI.h"
|
||||
|
||||
@@ -244,10 +244,12 @@ void ClientConnection::validateClient(const std::string & id, const std::string
|
||||
uname.resize(MAX_ACCOUNT_NAME_LENGTH);
|
||||
}
|
||||
|
||||
std::hash<std::string> h;
|
||||
suid = h(uname.c_str());
|
||||
suid = std::hash<std::string>(uname.c_str());
|
||||
}
|
||||
|
||||
// insert all related accounts, if not already there, into the db
|
||||
//taskmapaccount
|
||||
|
||||
LOG("LoginClientConnection", ("validateClient() for stationId (%lu) at IP (%s), id (%s)", m_stationId, getRemoteAddress().c_str(), uname.c_str()));
|
||||
|
||||
LoginServer::getInstance().onValidateClient(suid, uname, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF);
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
// ======================================================================
|
||||
//
|
||||
// TaskMapAccount.cpp
|
||||
// copyright (c) 2001 Sony Online Entertainment
|
||||
//
|
||||
// ======================================================================
|
||||
|
||||
#include "FirstLoginServer.h"
|
||||
#include "TaskMapAccount.h"
|
||||
|
||||
#include "ClientConnection.h"
|
||||
#include "DatabaseConnection.h"
|
||||
#include "sharedDatabaseInterface/DbSession.h"
|
||||
|
||||
// ======================================================================
|
||||
|
||||
TaskMapAccount::TaskMapAccount(StationId parentID, StationId childID) :
|
||||
TaskRequest(),
|
||||
m_parentID(parentID),
|
||||
m_childID(childID)
|
||||
{
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
bool TaskMapAccount::process(DB::Session *session)
|
||||
{
|
||||
MapAccountQuery qry;
|
||||
qry.parentID=m_parentId;
|
||||
qry.childID=m_childId;
|
||||
|
||||
bool rval = session->exec(&qry);
|
||||
|
||||
qry.done();
|
||||
return rval;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void TaskMapAccount::onComplete()
|
||||
{
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
TaskMapAccount::MapAccountQuery::MapAccountQuery() :
|
||||
Query(),
|
||||
parentID(),
|
||||
childID()
|
||||
{
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void TaskMapAccount::MapAccountQuery::getSQL(std::string &sql)
|
||||
{
|
||||
sql = std::string("begin ")+DatabaseConnection::getInstance().getSchemaQualifier()+"login.upsert_account_map(:parentID, :childID); end;";
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
bool TaskMapAccount::MapAccountQuery::bindParameters()
|
||||
{
|
||||
if (!bindParameter(parentID)) return false;
|
||||
if (!bindParameter(childID)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
bool TaskMapAccount::MapAccountQuery::bindColumns()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
DB::Query::QueryMode TaskMapAccount::MapAccountQuery::getExecutionMode() const
|
||||
{
|
||||
return MODE_PROCEXEC;
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
@@ -0,0 +1,57 @@
|
||||
// ======================================================================
|
||||
//
|
||||
// TaskMapAccount.h
|
||||
// copyright (c) 2016 StellaBellum
|
||||
//
|
||||
// ======================================================================
|
||||
|
||||
#ifndef INCLUDED_TaskMapAccount_H
|
||||
#define INCLUDED_TaskMapAccount_H
|
||||
|
||||
// ======================================================================
|
||||
|
||||
#include "sharedDatabaseInterface/Bindable.h"
|
||||
#include "sharedDatabaseInterface/BindableNetworkId.h"
|
||||
#include "sharedDatabaseInterface/DbQuery.h"
|
||||
#include "sharedDatabaseInterface/DbTaskRequest.h"
|
||||
|
||||
// ======================================================================
|
||||
|
||||
class TaskMapAccount : public DB::TaskRequest
|
||||
{
|
||||
public:
|
||||
TaskMapAccount(StationId parentID, StationId childID);
|
||||
|
||||
public:
|
||||
virtual bool process (DB::Session *session);
|
||||
virtual void onComplete ();
|
||||
|
||||
private:
|
||||
TaskMapAccount(); // disabled default constructor
|
||||
|
||||
class MapAccountQuery : public DB::Query
|
||||
{
|
||||
public:
|
||||
MapAccountQuery();
|
||||
|
||||
DB::BindableNetworkId parentID; //lint !e1925 // public data member
|
||||
DB::BindableLong childID; //lint !e1925 // public data member
|
||||
|
||||
virtual void getSQL(std::string &sql);
|
||||
virtual bool bindParameters();
|
||||
virtual bool bindColumns();
|
||||
virtual QueryMode getExecutionMode() const;
|
||||
|
||||
private: //disable
|
||||
MapAccountQuery(const MapAccountQuery&);
|
||||
MapAccountQuery &operator=(const MapAccountQuery&);
|
||||
};
|
||||
|
||||
private:
|
||||
StationId m_parentID;
|
||||
StationId m_childID;
|
||||
};
|
||||
|
||||
// ======================================================================
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user