Limited some extension query ID results to 1

MySQL is very strict about subquery size in insert, so duplicate rows
would cause issues in next inserts (Duplicates can occur if two servers
do the same work at the same time)
This commit is contained in:
Rsl1122 2019-10-25 15:30:36 +03:00
parent 641cd24077
commit f4ff03bbc9
6 changed files with 6 additions and 7 deletions

View File

@ -48,7 +48,7 @@ public class ExtensionIconTable {
FROM + TABLE_NAME +
WHERE + ICON_NAME + "=?" +
AND + FAMILY + "=?" +
AND + COLOR + "=?)";
AND + COLOR + "=? LIMIT 1)";
public static void set3IconValuesToStatement(PreparedStatement statement, Icon icon) throws SQLException {
set3IconValuesToStatement(statement, 1, icon);

View File

@ -44,7 +44,7 @@ public class ExtensionPluginTable {
public static final String STATEMENT_SELECT_PLUGIN_ID = '(' + SELECT + ID +
FROM + TABLE_NAME +
WHERE + PLUGIN_NAME + "=?" +
AND + SERVER_UUID + "=?)";
AND + SERVER_UUID + "=? LIMIT 1)";
public static void set2PluginValuesToStatement(PreparedStatement statement, int parameterIndex, String pluginName, UUID serverUUID) throws SQLException {
statement.setString(parameterIndex, pluginName);

View File

@ -54,7 +54,7 @@ public class ExtensionProviderTable {
public static final String STATEMENT_SELECT_PROVIDER_ID = '(' + SELECT + ID + FROM + TABLE_NAME +
WHERE + PROVIDER_NAME + "=?" +
AND + PLUGIN_ID + "=" + ExtensionPluginTable.STATEMENT_SELECT_PLUGIN_ID + ')';
AND + PLUGIN_ID + "=" + ExtensionPluginTable.STATEMENT_SELECT_PLUGIN_ID + " LIMIT 1)";
public static void set3PluginValuesToStatement(PreparedStatement statement, int parameterIndex, String providerName, String pluginName, UUID serverUUID) throws SQLException {
statement.setString(parameterIndex, providerName);

View File

@ -46,7 +46,7 @@ public class ExtensionTabTable {
public static final String STATEMENT_SELECT_TAB_ID = '(' + SELECT + ID +
FROM + TABLE_NAME +
WHERE + TAB_NAME + "=?" +
AND + PLUGIN_ID + "=" + ExtensionPluginTable.STATEMENT_SELECT_PLUGIN_ID + ')';
AND + PLUGIN_ID + "=" + ExtensionPluginTable.STATEMENT_SELECT_PLUGIN_ID + " LIMIT 1)";
public static void set3TabValuesToStatement(PreparedStatement statement, int parameterIndex, String tabName, String pluginName, UUID serverUUID) throws SQLException {
statement.setString(parameterIndex, tabName);

View File

@ -59,7 +59,7 @@ public class ExtensionTableProviderTable {
public static final String STATEMENT_SELECT_TABLE_ID = '(' + SELECT + ID + FROM + TABLE_NAME +
WHERE + PROVIDER_NAME + "=?" +
AND + PLUGIN_ID + "=" + ExtensionPluginTable.STATEMENT_SELECT_PLUGIN_ID + ')';
AND + PLUGIN_ID + "=" + ExtensionPluginTable.STATEMENT_SELECT_PLUGIN_ID + " LIMIT 1)";
private ExtensionTableProviderTable() {
/* Static information class */

View File

@ -58,8 +58,7 @@ public class ServerTable {
public static final String STATEMENT_SELECT_SERVER_ID =
'(' + SELECT + TABLE_NAME + '.' + SERVER_ID +
FROM + TABLE_NAME +
WHERE + TABLE_NAME + '.' + SERVER_UUID + "=?" +
" LIMIT 1)";
WHERE + TABLE_NAME + '.' + SERVER_UUID + "=? LIMIT 1)";
private ServerTable() {
/* Static information class */