Fixed stupid query thing....defek7.
Removed extra logging.
This commit is contained in:
parent
f39e3dcec7
commit
2afe84d7c7
@ -29,8 +29,6 @@ import mineplex.core.server.remotecall.JsonWebCall;
|
|||||||
|
|
||||||
public class AccountRepository extends RepositoryBase
|
public class AccountRepository extends RepositoryBase
|
||||||
{
|
{
|
||||||
private static String _loginString = null;
|
|
||||||
|
|
||||||
private static String CREATE_ACCOUNT_TABLE = "CREATE TABLE IF NOT EXISTS accounts (id INT NOT NULL AUTO_INCREMENT, uuid VARCHAR(100), name VARCHAR(40), gems INT, rank VARCHAR(40), rankPerm BOOL, rankExpire LONG, lastLogin LONG, totalPlayTime LONG, PRIMARY KEY (id), UNIQUE INDEX uuidIndex (uuid), UNIQUE INDEX nameIndex (name), INDEX rankIndex (rank));";
|
private static String CREATE_ACCOUNT_TABLE = "CREATE TABLE IF NOT EXISTS accounts (id INT NOT NULL AUTO_INCREMENT, uuid VARCHAR(100), name VARCHAR(40), gems INT, rank VARCHAR(40), rankPerm BOOL, rankExpire LONG, lastLogin LONG, totalPlayTime LONG, PRIMARY KEY (id), UNIQUE INDEX uuidIndex (uuid), UNIQUE INDEX nameIndex (name), INDEX rankIndex (rank));";
|
||||||
private static String ACCOUNT_LOGIN_NEW = "INSERT INTO accounts (uuid, name, lastLogin) values(?, ?, now()) ON DUPLICATE KEY UPDATE name=VALUES(name), lastLogin=VALUES(lastLogin);";
|
private static String ACCOUNT_LOGIN_NEW = "INSERT INTO accounts (uuid, name, lastLogin) values(?, ?, now()) ON DUPLICATE KEY UPDATE name=VALUES(name), lastLogin=VALUES(lastLogin);";
|
||||||
private static String UPDATE_ACCOUNT_RANK = "UPDATE accounts SET rank=?, rankPerm=false, rankExpire=now() + INTERVAL 1 MONTH WHERE uuid = ?;";
|
private static String UPDATE_ACCOUNT_RANK = "UPDATE accounts SET rank=?, rankPerm=false, rankExpire=now() + INTERVAL 1 MONTH WHERE uuid = ?;";
|
||||||
@ -101,16 +99,14 @@ public class AccountRepository extends RepositoryBase
|
|||||||
+ "SELECT gameType, elo FROM eloRating WHERE uuid = '" + uuid + "';"
|
+ "SELECT gameType, elo FROM eloRating WHERE uuid = '" + uuid + "';"
|
||||||
);
|
);
|
||||||
*/
|
*/
|
||||||
if (_loginString == null)
|
|
||||||
{
|
String loginString = "UPDATE accounts SET name='" + name + "', lastLogin=now() WHERE accounts.uuid = '" + uuid + "';";
|
||||||
_loginString = "UPDATE accounts SET name='" + name + "', lastLogin=now() WHERE accounts.uuid = '" + uuid + "';";
|
|
||||||
for (ILoginProcessor loginProcessor : loginProcessors.values())
|
for (ILoginProcessor loginProcessor : loginProcessors.values())
|
||||||
{
|
{
|
||||||
_loginString += loginProcessor.getQuery(uuid, name);
|
loginString += loginProcessor.getQuery(uuid, name);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
statement.execute(_loginString);
|
statement.execute(loginString);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
while (true)
|
while (true)
|
||||||
|
@ -90,8 +90,6 @@ public abstract class RepositoryBase implements Listener
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TimingManager.start(getClass().getName());
|
|
||||||
|
|
||||||
if (_connection == null || !_connection.isValid(1))
|
if (_connection == null || !_connection.isValid(1))
|
||||||
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
|
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
|
||||||
|
|
||||||
@ -104,8 +102,6 @@ public abstract class RepositoryBase implements Listener
|
|||||||
|
|
||||||
affectedRows = preparedStatement.executeUpdate();
|
affectedRows = preparedStatement.executeUpdate();
|
||||||
|
|
||||||
TimingManager.stop(getClass().getName());
|
|
||||||
|
|
||||||
if (callable != null)
|
if (callable != null)
|
||||||
callable.processResultSet(preparedStatement.getGeneratedKeys());
|
callable.processResultSet(preparedStatement.getGeneratedKeys());
|
||||||
}
|
}
|
||||||
@ -137,15 +133,13 @@ public abstract class RepositoryBase implements Listener
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TimingManager.start(getClass().getName());
|
|
||||||
|
|
||||||
for (int i=0; i < columns.length; i++)
|
for (int i=0; i < columns.length; i++)
|
||||||
{
|
{
|
||||||
columns[i].setValue(statement, i+1);
|
columns[i].setValue(statement, i+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
resultSet = statement.executeQuery();
|
resultSet = statement.executeQuery();
|
||||||
TimingManager.stop(getClass().getName());
|
|
||||||
callable.processResultSet(resultSet);
|
callable.processResultSet(resultSet);
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
@ -212,9 +206,7 @@ public abstract class RepositoryBase implements Listener
|
|||||||
columns[i].setValue(preparedStatement, i+1);
|
columns[i].setValue(preparedStatement, i+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
TimingManager.start(getClass().getName());
|
|
||||||
affectedRows = preparedStatement.executeUpdate();
|
affectedRows = preparedStatement.executeUpdate();
|
||||||
TimingManager.stop(getClass().getName());
|
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user