Fixed stupid query thing....defek7.

Removed extra logging.
This commit is contained in:
Jonathan Williams 2014-11-26 00:59:10 -08:00
parent f39e3dcec7
commit 2afe84d7c7
2 changed files with 8 additions and 20 deletions

View File

@ -28,9 +28,7 @@ import mineplex.core.database.column.ColumnVarChar;
import mineplex.core.server.remotecall.JsonWebCall;
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 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 = ?;";
@ -101,16 +99,14 @@ public class AccountRepository extends RepositoryBase
+ "SELECT gameType, elo FROM eloRating WHERE uuid = '" + uuid + "';"
);
*/
if (_loginString == null)
String loginString = "UPDATE accounts SET name='" + name + "', lastLogin=now() WHERE accounts.uuid = '" + uuid + "';";
for (ILoginProcessor loginProcessor : loginProcessors.values())
{
_loginString = "UPDATE accounts SET name='" + name + "', lastLogin=now() WHERE accounts.uuid = '" + uuid + "';";
for (ILoginProcessor loginProcessor : loginProcessors.values())
{
_loginString += loginProcessor.getQuery(uuid, name);
}
loginString += loginProcessor.getQuery(uuid, name);
}
statement.execute(_loginString);
statement.execute(loginString);
/*
while (true)

View File

@ -90,8 +90,6 @@ public abstract class RepositoryBase implements Listener
try
{
TimingManager.start(getClass().getName());
if (_connection == null || !_connection.isValid(1))
_connection = DriverManager.getConnection(_connectionString, _userName, _password);
@ -103,9 +101,7 @@ public abstract class RepositoryBase implements Listener
}
affectedRows = preparedStatement.executeUpdate();
TimingManager.stop(getClass().getName());
if (callable != null)
callable.processResultSet(preparedStatement.getGeneratedKeys());
}
@ -137,15 +133,13 @@ public abstract class RepositoryBase implements Listener
try
{
TimingManager.start(getClass().getName());
for (int i=0; i < columns.length; i++)
{
columns[i].setValue(statement, i+1);
}
resultSet = statement.executeQuery();
TimingManager.stop(getClass().getName());
callable.processResultSet(resultSet);
}
catch (Exception exception)
@ -212,9 +206,7 @@ public abstract class RepositoryBase implements Listener
columns[i].setValue(preparedStatement, i+1);
}
TimingManager.start(getClass().getName());
affectedRows = preparedStatement.executeUpdate();
TimingManager.stop(getClass().getName());
}
catch (Exception exception)
{