mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
Фикс инициализации MySQLAuthHandler
This commit is contained in:
parent
84a6784d26
commit
05bad22ede
2 changed files with 31 additions and 5 deletions
|
@ -118,6 +118,18 @@ public String getBindAddress() {
|
|||
return bindAddress;
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public void setBinaryName(String binaryName) {
|
||||
this.binaryName = binaryName;
|
||||
}
|
||||
|
||||
public void setEnv(LauncherConfig.LauncherEnvironment env) {
|
||||
this.env = env;
|
||||
}
|
||||
|
||||
|
||||
public SocketAddress getSocketAddress() {
|
||||
return new InetSocketAddress(bindAddress, port);
|
||||
|
@ -478,6 +490,8 @@ private void generateConfigIfNotExists() throws IOException {
|
|||
// Set server address
|
||||
LogHelper.println("LaunchServer address: ");
|
||||
newConfig.setAddress(commandHandler.readLine());
|
||||
LogHelper.println("LaunchServer projectName: ");
|
||||
newConfig.setProjectName(commandHandler.readLine());
|
||||
|
||||
// Write LaunchServer config
|
||||
LogHelper.info("Writing LaunchServer config file");
|
||||
|
|
|
@ -15,13 +15,25 @@ public final class MySQLAuthHandler extends CachedAuthHandler {
|
|||
private String usernameColumn;
|
||||
private String accessTokenColumn;
|
||||
private String serverIDColumn;
|
||||
private String table;
|
||||
|
||||
// Prepared SQL queries
|
||||
private String queryByUUIDSQL;
|
||||
private String queryByUsernameSQL;
|
||||
private String updateAuthSQL;
|
||||
private String updateServerIDSQL;
|
||||
|
||||
private transient String queryByUUIDSQL;
|
||||
private transient String queryByUsernameSQL;
|
||||
private transient String updateAuthSQL;
|
||||
private transient String updateServerIDSQL;
|
||||
public MySQLAuthHandler()
|
||||
{
|
||||
// Prepare SQL queries
|
||||
queryByUUIDSQL = String.format("SELECT %s, %s, %s, %s FROM %s WHERE %s=? LIMIT 1",
|
||||
uuidColumn, usernameColumn, accessTokenColumn, serverIDColumn, table, uuidColumn);
|
||||
queryByUsernameSQL = String.format("SELECT %s, %s, %s, %s FROM %s WHERE %s=? LIMIT 1",
|
||||
uuidColumn, usernameColumn, accessTokenColumn, serverIDColumn, table, usernameColumn);
|
||||
updateAuthSQL = String.format("UPDATE %s SET %s=?, %s=?, %s=NULL WHERE %s=? LIMIT 1",
|
||||
table, usernameColumn, accessTokenColumn, serverIDColumn, uuidColumn);
|
||||
updateServerIDSQL = String.format("UPDATE %s SET %s=? WHERE %s=? LIMIT 1",
|
||||
table, serverIDColumn, uuidColumn);
|
||||
}
|
||||
@Override
|
||||
public void close() {
|
||||
mySQLHolder.close();
|
||||
|
|
Loading…
Reference in a new issue