use of com.gamebuster19901.excite.bot.database.Result in project ExciteBot by TheGameCommunity.
the class Wii method getRegistrationCode.
public String getRegistrationCode() {
try {
Result result = Table.selectColumnsFromWhere(ConsoleContext.INSTANCE, REGISTRATION_CODE, WIIS, new Comparison(WII_ID, EQUALS, wiiCode));
if (result.next()) {
String ret = result.getString(REGISTRATION_CODE);
if (ret == null) {
generateRegistrationCode();
result = Table.selectColumnsFromWhere(ConsoleContext.INSTANCE, REGISTRATION_CODE, WIIS, new Comparison(WII_ID, EQUALS, wiiCode));
if (result.next()) {
return result.getString(REGISTRATION_CODE);
}
} else {
return ret;
}
} else {
generateRegistrationCode();
result = Table.selectColumnsFromWhere(ConsoleContext.INSTANCE, REGISTRATION_CODE, WIIS, new Comparison(WII_ID, EQUALS, wiiCode));
if (result.next()) {
return result.getString(REGISTRATION_CODE);
}
}
throw new AssertionError();
} catch (SQLException e) {
throw new IOError(e);
}
}
use of com.gamebuster19901.excite.bot.database.Result in project ExciteBot by TheGameCommunity.
the class DiscordUser method getDiscordUsersWithUsername.
@Deprecated
@SuppressWarnings("rawtypes")
public static final DiscordUser[] getDiscordUsersWithUsername(MessageContext context, String username) {
try {
ArrayList<DiscordUser> users = new ArrayList<DiscordUser>();
Result results = Table.selectAllFromWhere(context, DISCORD_USERS, new Comparison(DISCORD_NAME, LIKE, Table.makeSafe(username) + "_____"));
while (results.next()) {
users.add(new DiscordUser(results));
}
return users.toArray(new DiscordUser[] {});
} catch (SQLException e) {
throw new IOError(e);
}
}
use of com.gamebuster19901.excite.bot.database.Result in project ExciteBot by TheGameCommunity.
the class DiscordUser method getAllAdmins.
public static DiscordUser[] getAllAdmins() {
try {
PreparedStatement st = ConsoleContext.INSTANCE.getConnection().prepareStatement("SELECT * FROM discord_users INNER JOIN admins ON(discord_users.discordID = admins.discordID);");
Result results = st.query();
int columns = results.getColumnCount();
DiscordUser[] operators = new DiscordUser[columns];
for (int i = 0; i < columns; i++) {
results.next();
operators[i] = new DiscordUser(results);
}
return operators;
} catch (SQLException e) {
throw new AssertionError(e);
}
}
use of com.gamebuster19901.excite.bot.database.Result in project ExciteBot by TheGameCommunity.
the class DiscordServer method getKnownDiscordServers.
public static DiscordServer[] getKnownDiscordServers() {
try {
ArrayList<DiscordServer> servers = new ArrayList<DiscordServer>();
Result results = Table.selectAllFrom(ConsoleContext.INSTANCE, DISCORD_SERVERS);
while (results.next()) {
servers.add(new DiscordServer(results));
}
return servers.toArray(new DiscordServer[] {});
} catch (SQLException e) {
throw new IOError(e);
}
}
use of com.gamebuster19901.excite.bot.database.Result in project ExciteBot by TheGameCommunity.
the class DiscordUser method getRegisteredWiis.
@Nullable
public Wii[] getRegisteredWiis() {
try {
HashSet<Wii> wiis = new HashSet<Wii>();
Result result = Table.selectColumnsFromWhere(ConsoleContext.INSTANCE, WII_ID, WIIS, new Comparison(DISCORD_ID, EQUALS, getID()));
while (result.next()) {
wiis.add(Wii.getWii(result.getString(WII_ID)));
}
return (Wii[]) wiis.toArray(new Wii[] {});
} catch (SQLException e) {
throw new IOError(e);
}
}
Aggregations