This commit is contained in:
DarthArgus
2016-12-26 23:49:59 -06:00
parent 4ce4bd13d6
commit 35e92f519f
5 changed files with 16 additions and 39 deletions

View File

@@ -225,7 +225,8 @@ void ClientConnection::validateClient(const std::string &id, const std::string &
std::hash<std::string> h;
StationId parent = h(parentAccount);
WARNING(true, ("Parent account is %s", parentAccount.c_str()));
REPORT_LOG(true,
("Client connected. Station Id: %llu, Username: %s, Parent %s\n", suid, uname.c_str(), parentAccount.c_str()));
for (auto i : childAccounts) {
if (i.length() > MAX_ACCOUNT_NAME_LENGTH) {
@@ -233,7 +234,7 @@ void ClientConnection::validateClient(const std::string &id, const std::string &
}
StationId childID = h(i);
printf ("\tFound child account %s (%llu)", i.c_str(), childID);
REPORT_LOG(true, ("\tA child account for %s is %s (%llu)\n", parentAccount.c_str(), i.c_str(), childID));
// insert all related accounts, if not already there, into the db
DatabaseConnection::getInstance().upsertAccountRelationship(parent, childID);

View File

@@ -1484,7 +1484,6 @@ void LoginServer::onValidateClient(StationId suid, const std::string & username,
//Send off request for the avatar list from the database.
DatabaseConnection::getInstance().requestAvatarListForAccount(suid, 0);
REPORT_LOG(true, ("Client connected. Station Id: %lu, Username: %s\n", suid, username.c_str()));
LOG("LoginClientConnection", ("onValidateClient() for stationId (%lu) at IP (%s), id (%s), requesting avatar list for account", suid, conn->getRemoteAddress().c_str(), username.c_str()));
//Set up the connection as being validated with this suid.

View File

@@ -17,17 +17,15 @@
TaskMapAccount::TaskMapAccount(StationId parentID, StationId childID) :
TaskRequest(),
m_parentID(parentID),
m_childID(childID)
{
m_childID(childID) {
}
// ----------------------------------------------------------------------
bool TaskMapAccount::process(DB::Session *session)
{
bool TaskMapAccount::process(DB::Session *session) {
MapAccountQuery qry;
qry.parentID=m_parentID;
qry.childID=m_childID;
qry.parentID = m_parentID;
qry.childID = m_childID;
bool rval = session->exec(&qry);
@@ -37,8 +35,7 @@ bool TaskMapAccount::process(DB::Session *session)
// ----------------------------------------------------------------------
void TaskMapAccount::onComplete()
{
void TaskMapAccount::onComplete() {
}
// ======================================================================
@@ -46,25 +43,19 @@ void TaskMapAccount::onComplete()
TaskMapAccount::MapAccountQuery::MapAccountQuery() :
Query(),
parentID(),
childID()
{
childID() {
}
// ----------------------------------------------------------------------
void TaskMapAccount::MapAccountQuery::getSQL(std::string &sql)
{
sql = std::string("begin ")+DatabaseConnection::getInstance().getSchemaQualifier()+"merge into account_map st \
using (select :parentID parent_id, :childID child_id from dual) v \
on (st.parent_id = v.parent_id and st.child_id = v.child_id) \
when not matched then insert (parent_id, child_id) values (v.parent_id, v.child_id); \
end;";
void TaskMapAccount::MapAccountQuery::getSQL(std::string &sql) {
sql = std::string("begin ") + DatabaseConnection::getInstance().getSchemaQualifier() +
"merge into account_map am using (select :parentID parent_id, :childID child_id from dual) v on (am.parent_id = v.parent_id and am.child_id = v.child_id) when not matched then insert (parent_id, child_id) values (v.parent_id, v.child_id); end;";
}
// ----------------------------------------------------------------------
bool TaskMapAccount::MapAccountQuery::bindParameters()
{
bool TaskMapAccount::MapAccountQuery::bindParameters() {
if (!bindParameter(parentID)) return false;
if (!bindParameter(childID)) return false;
return true;
@@ -72,15 +63,13 @@ bool TaskMapAccount::MapAccountQuery::bindParameters()
// ----------------------------------------------------------------------
bool TaskMapAccount::MapAccountQuery::bindColumns()
{
bool TaskMapAccount::MapAccountQuery::bindColumns() {
return true;
}
// ----------------------------------------------------------------------
DB::Query::QueryMode TaskMapAccount::MapAccountQuery::getExecutionMode() const
{
DB::Query::QueryMode TaskMapAccount::MapAccountQuery::getExecutionMode() const {
return MODE_PROCEXEC;
}

View File

@@ -510,14 +510,4 @@ as
when others then
return 0;
end;
function upsert_account_map(parent_station_id in number, child_station_id in number) return number
as
begin
insert into account_map (parent_id, child_id) values (parent_station_id, child_station_id);
exception when DUP_VAL_ON_INDEX then
return 1;
return sql%rowcount;
end;
end;

View File

@@ -3,9 +3,7 @@ CREATE TABLE "ACCOUNT_MAP"
"PARENT_ID" NUMBER(38,0) NOT NULL ENABLE,
"CHILD_ID" NUMBER(38,0) NOT NULL ENABLE,
CONSTRAINT "ACCOUNT_MAP_UK1" UNIQUE ("CHILD_ID", "PARENT_ID") USING INDEX (CREATE INDEX "ACCOUNT_MAP_INDEX2" ON "ACCOUNT_MAP" ("CHILD_ID","PARENT_ID")),
CONSTRAINT "ACCOUNT_MAP_UK2" UNIQUE ("CHILD_ID") USING INDEX (CREATE INDEX "ACCOUNT_MAP_INDEX1" ON "ACCOUNT_MAP" ("CHILD_ID")),
CONSTRAINT "ACCOUNT_MAP_FK1" FOREIGN KEY ("PARENT_ID") REFERENCES "ACCOUNTS" ("STATION_ID"),
CONSTRAINT "ACCOUNT_MAP_FK2" FOREIGN KEY ("CHILD_ID") REFERENCES "ACCOUNTS" ("STATION_ID")
CONSTRAINT "ACCOUNT_MAP_UK2" UNIQUE ("CHILD_ID") USING INDEX (CREATE INDEX "ACCOUNT_MAP_INDEX1" ON "ACCOUNT_MAP" ("CHILD_ID"))
);
update version_number set version_number=270, min_version_number=270;