Fixed Extension SQL syntax errors

This commit is contained in:
Rsl1122 2019-03-20 14:37:55 +02:00
parent 0c95a4cc63
commit 09787f4ff1
15 changed files with 30 additions and 27 deletions

View File

@ -63,8 +63,8 @@ public class ExtensionIconTable {
return CreateTableParser.create(TABLE_NAME, dbType)
.column(ID, INT).primaryKey()
.column(ICON_NAME, Sql.varchar(50)).notNull().defaultValue("'question'")
.column(FAMILY, Sql.varchar(15)).notNull().defaultValue(Family.SOLID.name())
.column(COLOR, Sql.varchar(25)).notNull().defaultValue(Color.NONE.name())
.column(FAMILY, Sql.varchar(15)).notNull().defaultValue("'" + Family.SOLID.name() + "'")
.column(COLOR, Sql.varchar(25)).notNull().defaultValue("'" + Color.NONE.name() + "'")
.build();
}
}

View File

@ -41,7 +41,7 @@ public class ExtensionProviderTable {
public static final String DESCRIPTION = "description"; // Can be null
public static final String PRIORITY = "priority";
public static final String GROUPABLE = "groupable"; // default false
public static final String CONDITION = "condition"; // Can be null
public static final String CONDITION = "condition_name"; // Can be null
public static final String PLUGIN_ID = "plugin_id";
public static final String ICON_ID = "icon_id";
public static final String TAB_ID = "tab_id"; // Can be null

View File

@ -20,6 +20,7 @@ import com.djrapitops.plan.data.plugin.PluginsConfigSection;
import com.djrapitops.plan.extension.implementation.DataProviderExtractor;
import com.djrapitops.plan.extension.implementation.ExtensionRegister;
import com.djrapitops.plan.extension.implementation.providers.gathering.ProviderValueGatherer;
import com.djrapitops.plan.system.DebugChannels;
import com.djrapitops.plan.system.database.DBSystem;
import com.djrapitops.plan.system.info.server.ServerInfo;
import com.djrapitops.plan.system.settings.config.PlanConfig;
@ -91,7 +92,7 @@ public class ExtensionServiceImplementation implements ExtensionService {
gatherer.storeExtensionInformation();
extensionGatherers.put(pluginName, gatherer);
logger.debug(pluginName + " extension registered.");
logger.debug(DebugChannels.DATA_EXTENSIONS, pluginName + " extension registered.");
}
private boolean shouldNotAllowRegistration(String pluginName) {
@ -107,7 +108,7 @@ public class ExtensionServiceImplementation implements ExtensionService {
}
if (!pluginsConfig.isEnabled(pluginName)) {
logger.debug(pluginName + " extension disabled in the config.");
logger.debug(DebugChannels.DATA_EXTENSIONS, pluginName + " extension disabled in the config.");
return true;
}
return false; // Should register.

View File

@ -65,11 +65,11 @@ public class StorePluginTabTransaction extends Transaction {
private Executable updateTab() {
String sql = "UPDATE " + ExtensionTabTable.TABLE_NAME +
" SET (" +
" SET " +
ExtensionTabTable.TAB_PRIORITY + "=?," +
ExtensionTabTable.ELEMENT_ORDER + "=?," +
ExtensionTabTable.ICON_ID + "=" + ExtensionIconTable.STATEMENT_SELECT_ICON_ID + "," +
")" + WHERE + ExtensionTabTable.PLUGIN_ID + "=" + ExtensionPluginTable.STATEMENT_SELECT_PLUGIN_ID +
WHERE + ExtensionTabTable.PLUGIN_ID + "=" + ExtensionPluginTable.STATEMENT_SELECT_PLUGIN_ID +
AND + ExtensionTabTable.TAB_NAME + "=?";
return new ExecStatement(sql) {
@Override

View File

@ -65,10 +65,10 @@ public class StorePluginTransaction extends Transaction {
private Executable updatePlugin() {
String sql = "UPDATE " + ExtensionPluginTable.TABLE_NAME +
" SET (" +
" SET " +
ExtensionPluginTable.LAST_UPDATED + "=?," +
ExtensionPluginTable.ICON_ID + "=" + ExtensionIconTable.STATEMENT_SELECT_ICON_ID +
")" + WHERE + ExtensionPluginTable.PLUGIN_NAME + "=?" +
WHERE + ExtensionPluginTable.PLUGIN_NAME + "=?" +
AND + ExtensionPluginTable.SERVER_UUID + "=?";
return new ExecStatement(sql) {
@Override

View File

@ -66,7 +66,7 @@ public class StoreBooleanProviderTransaction extends Transaction {
private Executable updateProvider() {
String sql = "UPDATE " + TABLE_NAME +
" SET (" +
" SET " +
TEXT + "=?," +
DESCRIPTION + "=?," +
PRIORITY + "=?," +
@ -74,7 +74,7 @@ public class StoreBooleanProviderTransaction extends Transaction {
PROVIDED_CONDITION + "=?," +
TAB_ID + "=" + ExtensionTabTable.STATEMENT_SELECT_TAB_ID + "," +
ICON_ID + "=" + ExtensionIconTable.STATEMENT_SELECT_ICON_ID +
")" + WHERE + PLUGIN_ID + "=" + ExtensionPluginTable.STATEMENT_SELECT_PLUGIN_ID +
WHERE + PLUGIN_ID + "=" + ExtensionPluginTable.STATEMENT_SELECT_PLUGIN_ID +
AND + PROVIDER_NAME + "=?";
return new ExecStatement(sql) {

View File

@ -68,14 +68,14 @@ public class StoreDoubleProviderTransaction extends Transaction {
private Executable updateProvider() {
String sql = "UPDATE " + TABLE_NAME +
" SET (" +
" SET " +
TEXT + "=?," +
DESCRIPTION + "=?," +
PRIORITY + "=?," +
CONDITION + "=?," +
TAB_ID + "=" + ExtensionTabTable.STATEMENT_SELECT_TAB_ID + "," +
ICON_ID + "=" + ExtensionIconTable.STATEMENT_SELECT_ICON_ID +
")" + WHERE + PLUGIN_ID + "=" + ExtensionPluginTable.STATEMENT_SELECT_PLUGIN_ID +
WHERE + PLUGIN_ID + "=" + ExtensionPluginTable.STATEMENT_SELECT_PLUGIN_ID +
AND + PROVIDER_NAME + "=?";
return new ExecStatement(sql) {

View File

@ -67,7 +67,7 @@ public class StoreNumberProviderTransaction extends Transaction {
private Executable updateProvider() {
String sql = "UPDATE " + TABLE_NAME +
" SET (" +
" SET " +
TEXT + "=?," +
DESCRIPTION + "=?," +
PRIORITY + "=?," +
@ -75,7 +75,7 @@ public class StoreNumberProviderTransaction extends Transaction {
FORMAT_TYPE + "=?," +
TAB_ID + "=" + ExtensionTabTable.STATEMENT_SELECT_TAB_ID + "," +
ICON_ID + "=" + ExtensionIconTable.STATEMENT_SELECT_ICON_ID +
")" + WHERE + PLUGIN_ID + "=" + ExtensionPluginTable.STATEMENT_SELECT_PLUGIN_ID +
WHERE + PLUGIN_ID + "=" + ExtensionPluginTable.STATEMENT_SELECT_PLUGIN_ID +
AND + PROVIDER_NAME + "=?";
return new ExecStatement(sql) {

View File

@ -66,7 +66,7 @@ public class StoreStringProviderTransaction extends Transaction {
private Executable updateProvider() {
String sql = "UPDATE " + TABLE_NAME +
" SET (" +
" SET " +
TEXT + "=?," +
DESCRIPTION + "=?," +
PRIORITY + "=?," +
@ -74,7 +74,7 @@ public class StoreStringProviderTransaction extends Transaction {
IS_PLAYER_NAME + "=?," +
TAB_ID + "=" + ExtensionTabTable.STATEMENT_SELECT_TAB_ID + "," +
ICON_ID + "=" + ExtensionIconTable.STATEMENT_SELECT_ICON_ID +
")" + WHERE + PLUGIN_ID + "=" + ExtensionPluginTable.STATEMENT_SELECT_PLUGIN_ID +
WHERE + PLUGIN_ID + "=" + ExtensionPluginTable.STATEMENT_SELECT_PLUGIN_ID +
AND + PROVIDER_NAME + "=?";
return new ExecStatement(sql) {

View File

@ -67,9 +67,9 @@ public class StorePlayerBooleanResultTransaction extends Transaction {
private Executable updateValue() {
String sql = "UPDATE " + TABLE_NAME +
" SET (" +
" SET " +
BOOLEAN_VALUE + "=?" +
")" + WHERE + USER_UUID + "=?" +
WHERE + USER_UUID + "=?" +
AND + PROVIDER_ID + "=" + ExtensionProviderTable.STATEMENT_SELECT_PROVIDER_ID;
return new ExecStatement(sql) {

View File

@ -67,9 +67,9 @@ public class StorePlayerDoubleResultTransaction extends Transaction {
private Executable updateValue() {
String sql = "UPDATE " + TABLE_NAME +
" SET (" +
" SET " +
DOUBLE_VALUE + "=?" +
")" + WHERE + USER_UUID + "=?" +
WHERE + USER_UUID + "=?" +
AND + PROVIDER_ID + "=" + ExtensionProviderTable.STATEMENT_SELECT_PROVIDER_ID;
return new ExecStatement(sql) {

View File

@ -67,9 +67,9 @@ public class StorePlayerNumberResultTransaction extends Transaction {
private Executable updateValue() {
String sql = "UPDATE " + TABLE_NAME +
" SET (" +
" SET " +
LONG_VALUE + "=?" +
")" + WHERE + USER_UUID + "=?" +
WHERE + USER_UUID + "=?" +
AND + PROVIDER_ID + "=" + ExtensionProviderTable.STATEMENT_SELECT_PROVIDER_ID;
return new ExecStatement(sql) {

View File

@ -67,9 +67,9 @@ public class StorePlayerPercentageResultTransaction extends Transaction {
private Executable updateValue() {
String sql = "UPDATE " + TABLE_NAME +
" SET (" +
" SET " +
PERCENTAGE_VALUE + "=?" +
")" + WHERE + USER_UUID + "=?" +
WHERE + USER_UUID + "=?" +
AND + PROVIDER_ID + "=" + ExtensionProviderTable.STATEMENT_SELECT_PROVIDER_ID;
return new ExecStatement(sql) {

View File

@ -67,9 +67,9 @@ public class StorePlayerStringResultTransaction extends Transaction {
private Executable updateValue() {
String sql = "UPDATE " + TABLE_NAME +
" SET (" +
" SET " +
STRING_VALUE + "=?" +
")" + WHERE + USER_UUID + "=?" +
WHERE + USER_UUID + "=?" +
AND + PROVIDER_ID + "=" + ExtensionProviderTable.STATEMENT_SELECT_PROVIDER_ID;
return new ExecStatement(sql) {

View File

@ -23,6 +23,7 @@ package com.djrapitops.plan.system;
*/
public class DebugChannels {
private DebugChannels() {
/* Static variable class */
}
@ -33,5 +34,6 @@ public class DebugChannels {
public static final String WEB_REQUESTS = "Web Requests";
public static final String IMPORTING = "Importing";
public static final String SQL = "SQL";
public static final String DATA_EXTENSIONS = "DataExtensions";
}