From 35e92f519f2531fdebd9e0c63c8e96d7ba0de168 Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Mon, 26 Dec 2016 23:49:59 -0600 Subject: [PATCH] cleanup --- .../src/shared/ClientConnection.cpp | 5 +-- .../LoginServer/src/shared/LoginServer.cpp | 1 - .../LoginServer/src/shared/TaskMapAccount.cpp | 35 +++++++------------ .../database/login_packages/login.plsql | 10 ------ game/server/database/updates/270.sql | 4 +-- 5 files changed, 16 insertions(+), 39 deletions(-) diff --git a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp index 17c9a9c7..e48e6463 100755 --- a/engine/server/application/LoginServer/src/shared/ClientConnection.cpp +++ b/engine/server/application/LoginServer/src/shared/ClientConnection.cpp @@ -225,7 +225,8 @@ void ClientConnection::validateClient(const std::string &id, const std::string & std::hash 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); diff --git a/engine/server/application/LoginServer/src/shared/LoginServer.cpp b/engine/server/application/LoginServer/src/shared/LoginServer.cpp index ee51db59..db98bbb0 100755 --- a/engine/server/application/LoginServer/src/shared/LoginServer.cpp +++ b/engine/server/application/LoginServer/src/shared/LoginServer.cpp @@ -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. diff --git a/engine/server/application/LoginServer/src/shared/TaskMapAccount.cpp b/engine/server/application/LoginServer/src/shared/TaskMapAccount.cpp index bc09ba76..24ef2ded 100644 --- a/engine/server/application/LoginServer/src/shared/TaskMapAccount.cpp +++ b/engine/server/application/LoginServer/src/shared/TaskMapAccount.cpp @@ -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; } diff --git a/game/server/database/login_packages/login.plsql b/game/server/database/login_packages/login.plsql index 85c92cfb..cdf5251d 100644 --- a/game/server/database/login_packages/login.plsql +++ b/game/server/database/login_packages/login.plsql @@ -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; \ No newline at end of file diff --git a/game/server/database/updates/270.sql b/game/server/database/updates/270.sql index 919fbc19..95409edf 100644 --- a/game/server/database/updates/270.sql +++ b/game/server/database/updates/270.sql @@ -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;