diff --git a/application/jspmyadmin/pom.xml b/application/jspmyadmin/pom.xml index 7605317..6bd36fd 100644 --- a/application/jspmyadmin/pom.xml +++ b/application/jspmyadmin/pom.xml @@ -17,7 +17,7 @@ http://localhost:8080/manager/html - 8000 + 8010 / diff --git a/application/jspmyadmin/src/main/java/com/jspmyadmin/app/common/controllers/InstallController.java b/application/jspmyadmin/src/main/java/com/jspmyadmin/app/common/controllers/InstallController.java index 943bf06..9cdb0c9 100644 --- a/application/jspmyadmin/src/main/java/com/jspmyadmin/app/common/controllers/InstallController.java +++ b/application/jspmyadmin/src/main/java/com/jspmyadmin/app/common/controllers/InstallController.java @@ -62,7 +62,6 @@ private void save() { view.setType(ViewType.REDIRECT); view.setPath(AppConstants.PATH_HOME); } catch (IOException e) { - e.printStackTrace(); redirectParams.put(Constants.ERR_KEY, AppConstants.ERR_UNABLE_TO_CONNECT_WITH_SERVER); view.setType(ViewType.REDIRECT); view.setPath(AppConstants.PATH_INSTALL); diff --git a/application/jspmyadmin/src/main/java/com/jspmyadmin/app/database/event/logic/EventLogic.java b/application/jspmyadmin/src/main/java/com/jspmyadmin/app/database/event/logic/EventLogic.java index ee7ddd1..2f0c455 100644 --- a/application/jspmyadmin/src/main/java/com/jspmyadmin/app/database/event/logic/EventLogic.java +++ b/application/jspmyadmin/src/main/java/com/jspmyadmin/app/database/event/logic/EventLogic.java @@ -153,7 +153,6 @@ public void enableEvent(Bean bean) throws SQLException { builder.append(enable); statement = apiConnection.getStmt(builder.toString()); statement.execute(); - statement = null; builder.delete(0, builder.length()); } apiConnection.commit(); @@ -190,7 +189,6 @@ public void dropEvent(Bean bean) throws SQLException { builder.append(Constants.SYMBOL_TEN); statement = apiConnection.getStmt(builder.toString()); statement.execute(); - statement = null; builder.delete(0, builder.length()); } apiConnection.commit(); @@ -230,7 +228,6 @@ public void disableEvent(Bean bean) throws SQLException { builder.append(disable); statement = apiConnection.getStmt(builder.toString()); statement.execute(); - statement = null; builder.delete(0, builder.length()); } apiConnection.commit(); diff --git a/application/jspmyadmin/src/main/java/com/jspmyadmin/app/database/sql/controllers/ExternalSqlController.java b/application/jspmyadmin/src/main/java/com/jspmyadmin/app/database/sql/controllers/ExternalSqlController.java index f17dba6..ed91c45 100644 --- a/application/jspmyadmin/src/main/java/com/jspmyadmin/app/database/sql/controllers/ExternalSqlController.java +++ b/application/jspmyadmin/src/main/java/com/jspmyadmin/app/database/sql/controllers/ExternalSqlController.java @@ -55,6 +55,7 @@ private void alterSql() throws JSONException, SQLException { case 1: // alter view StructureBean structureBean = new StructureBean(); + structureBean.setRequest_db(bean.getRequest_db()); structureBean.setTables(new String[] { bean.getEdit_name() }); StructureLogic structureLogic = new StructureLogic(); String result = structureLogic.showCreate(structureBean, false); @@ -75,6 +76,7 @@ private void alterSql() throws JSONException, SQLException { case 2: // alter procedure RoutineListBean routineListBean = new RoutineListBean(); + routineListBean.setRequest_db(bean.getRequest_db()); routineListBean.setRoutines(new String[] { bean.getEdit_name() }); RoutineLogic routineLogic = new RoutineLogic(); result = routineLogic.showCreate(routineListBean, true); @@ -109,6 +111,7 @@ private void alterSql() throws JSONException, SQLException { case 4: // alter function routineListBean = new RoutineListBean(); + routineListBean.setRequest_db(bean.getRequest_db()); routineListBean.setRoutines(new String[] { bean.getEdit_name() }); routineLogic = new RoutineLogic(); result = routineLogic.showCreate(routineListBean, false); @@ -143,6 +146,7 @@ private void alterSql() throws JSONException, SQLException { case 6: // alter event EventListBean eventListBean = new EventListBean(); + eventListBean.setRequest_db(bean.getRequest_db()); eventListBean.setEvents(new String[] { bean.getEdit_name() }); EventLogic eventLogic = new EventLogic(); result = eventLogic.getShowCreate(eventListBean); diff --git a/application/jspmyadmin/src/main/java/com/jspmyadmin/app/database/structure/controllers/CreateViewPostController.java b/application/jspmyadmin/src/main/java/com/jspmyadmin/app/database/structure/controllers/CreateViewPostController.java index fae2278..65f9635 100644 --- a/application/jspmyadmin/src/main/java/com/jspmyadmin/app/database/structure/controllers/CreateViewPostController.java +++ b/application/jspmyadmin/src/main/java/com/jspmyadmin/app/database/structure/controllers/CreateViewPostController.java @@ -69,7 +69,7 @@ private JSONObject createView() throws JSONException, EncodingException { } } catch (SQLException e) { jsonObject.append(Constants.ERR, e.getMessage()); - } + } jsonObject.put(Constants.TOKEN, requestAdaptor.generateToken()); return jsonObject; } diff --git a/application/jspmyadmin/src/main/java/com/jspmyadmin/app/database/trigger/controllers/CreateTriggerController.java b/application/jspmyadmin/src/main/java/com/jspmyadmin/app/database/trigger/controllers/CreateTriggerController.java index 5eea127..bc5dcd8 100644 --- a/application/jspmyadmin/src/main/java/com/jspmyadmin/app/database/trigger/controllers/CreateTriggerController.java +++ b/application/jspmyadmin/src/main/java/com/jspmyadmin/app/database/trigger/controllers/CreateTriggerController.java @@ -10,6 +10,7 @@ import com.jspmyadmin.app.database.trigger.logic.TriggerLogic; import com.jspmyadmin.framework.constants.AppConstants; import com.jspmyadmin.framework.constants.Constants; +import com.jspmyadmin.framework.exception.EncodingException; import com.jspmyadmin.framework.web.annotations.Detect; import com.jspmyadmin.framework.web.annotations.HandlePost; import com.jspmyadmin.framework.web.annotations.Model; @@ -17,6 +18,7 @@ import com.jspmyadmin.framework.web.annotations.WebController; import com.jspmyadmin.framework.web.utils.Messages; import com.jspmyadmin.framework.web.utils.RedirectParams; +import com.jspmyadmin.framework.web.utils.RequestAdaptor; import com.jspmyadmin.framework.web.utils.RequestLevel; import com.jspmyadmin.framework.web.utils.View; import com.jspmyadmin.framework.web.utils.ViewType; @@ -29,6 +31,8 @@ @WebController(authentication = true, path = "/database_trigger_create.html", requestLevel = RequestLevel.DATABASE) public class CreateTriggerController { + @Detect + private RequestAdaptor requestAdaptor; @Detect private RedirectParams redirectParams; @Detect @@ -40,7 +44,7 @@ public class CreateTriggerController { @HandlePost @ValidateToken - private void createTrigger() { + private void createTrigger() throws EncodingException { try { TriggerLogic triggerLogic = new TriggerLogic(); if (triggerLogic.isExisted(bean.getTrigger_name(), bean.getRequest_db())) { @@ -54,6 +58,7 @@ private void createTrigger() { bean.setDatabase_name(bean.getRequest_db()); DataLogic dataLogic = new DataLogic(); bean.setDatabase_name_list(dataLogic.getDatabaseList()); + bean.setToken(requestAdaptor.generateToken()); } catch (SQLException e) { redirectParams.put(Constants.ERR, e.getMessage()); view.setType(ViewType.REDIRECT); diff --git a/application/jspmyadmin/src/main/java/com/jspmyadmin/app/table/structure/logic/StructureLogic.java b/application/jspmyadmin/src/main/java/com/jspmyadmin/app/table/structure/logic/StructureLogic.java index 81428ed..6e2eecf 100644 --- a/application/jspmyadmin/src/main/java/com/jspmyadmin/app/table/structure/logic/StructureLogic.java +++ b/application/jspmyadmin/src/main/java/com/jspmyadmin/app/table/structure/logic/StructureLogic.java @@ -252,6 +252,7 @@ public void fillAlterBean(Bean bean) throws SQLException { alterColumnBean.setNew_comments(alterColumnBean.getOld_comments()); } close(resultSet); + close(statement); String uniqueQuery = "SHOW KEYS FROM `" + _table + "` WHERE key_name <> ? AND non_unique = ?"; statement = apiConnection.getStmtSelect(uniqueQuery); @@ -263,6 +264,7 @@ public void fillAlterBean(Bean bean) throws SQLException { oldUniqueList.add(resultSet.getString("column_name")); } close(resultSet); + close(statement); builder = new StringBuilder(); builder.append("SHOW FULL COLUMNS FROM `"); @@ -659,6 +661,7 @@ public String alterColumns(Bean bean) throws SQLException { old_primary_key = resultSet.getString("column_name"); } close(resultSet); + close(statement); boolean oldPKStatus = false; for (int i = 0; i < alterColumnBean.getOld_columns().length; i++) { diff --git a/application/jspmyadmin/src/main/webapp/WEB-INF/views/database/event/Events.jsp b/application/jspmyadmin/src/main/webapp/WEB-INF/views/database/event/Events.jsp index efd4162..109e60f 100644 --- a/application/jspmyadmin/src/main/webapp/WEB-INF/views/database/event/Events.jsp +++ b/application/jspmyadmin/src/main/webapp/WEB-INF/views/database/event/Events.jsp @@ -560,7 +560,7 @@ return; } $('#sql-form').find('input[name="edit_type"]').val('6'); - $('#sql-form').find('input[name="edit_name"]').val($('input[name="tables"]:checked:first').val()); + $('#sql-form').find('input[name="edit_name"]').val($('input[name="events"]:checked:first').val()); $('#sql-form').submit(); }); }); diff --git a/application/jspmyadmin/src/main/webapp/WEB-INF/views/database/structure/Tables.jsp b/application/jspmyadmin/src/main/webapp/WEB-INF/views/database/structure/Tables.jsp index 7871575..f537063 100644 --- a/application/jspmyadmin/src/main/webapp/WEB-INF/views/database/structure/Tables.jsp +++ b/application/jspmyadmin/src/main/webapp/WEB-INF/views/database/structure/Tables.jsp @@ -331,7 +331,7 @@ @@ -436,7 +436,7 @@ @@ -503,7 +503,7 @@ @@ -584,7 +584,7 @@ diff --git a/application/jspmyadmin/src/main/webapp/WEB-INF/views/database/structure/Views.jsp b/application/jspmyadmin/src/main/webapp/WEB-INF/views/database/structure/Views.jsp index 3945f2a..e876324 100644 --- a/application/jspmyadmin/src/main/webapp/WEB-INF/views/database/structure/Views.jsp +++ b/application/jspmyadmin/src/main/webapp/WEB-INF/views/database/structure/Views.jsp @@ -244,7 +244,7 @@ @@ -311,7 +311,7 @@ diff --git a/application/jspmyadmin/src/main/webapp/WEB-INF/views/table/data/Data.jsp b/application/jspmyadmin/src/main/webapp/WEB-INF/views/table/data/Data.jsp index ff61656..b1a3800 100644 --- a/application/jspmyadmin/src/main/webapp/WEB-INF/views/table/data/Data.jsp +++ b/application/jspmyadmin/src/main/webapp/WEB-INF/views/table/data/Data.jsp @@ -309,7 +309,7 @@ input[readonly] {