1 package smile.stored; 2 3 import java.util.*; 4 import java.sql.*; 5 6 16 public class s_editGroup extends StoredProcedure implements ProcedureInterface { 17 18 String in_groupID; 20 21 String in_groupName; 22 23 String in_groupDesc; 24 25 String in_groupType; 26 27 String in_newgroupid; 28 29 public s_editGroup() { 30 } 31 32 public void init(HashMap initData, Connection con) { 33 super.init(initData, con); 35 in_groupID = utils.getString(data, "GROUPID", ""); 37 in_groupName = utils.getString(data, "GROUPNAME", ""); 38 in_groupDesc = utils.getString(data, "GROUPDESC", ""); 39 in_groupType = utils.getString(data, "GROUPTYPE", ""); 40 } 41 42 public void checkParams() throws SQLException { 43 } 44 45 public void checkAction() throws SQLException { 46 if (in_groupID.equals("0")) { 47 action = "insert"; 48 } else { 49 action = "update"; 50 } 51 } 52 53 public void executeAction() throws SQLException { 54 String v_select = ""; 55 v_select = "select " + in_groupID + " as GROUPID"; 56 57 if (action.equals("update")) { 58 StringBuffer v_sb = new StringBuffer (); 59 v_sb.append("UPDATE tblpermgroups ").append(" SET groupname = '" + in_groupName + "',").append(" groupdesc = '" + in_groupDesc + "',").append( 60 " grouptype = " + in_groupType).append(" WHERE groupid = " + in_groupID); 61 62 execStatement(v_sb.toString()); 63 } else if (action.equals("insert")) { 64 StringBuffer v_sb = new StringBuffer (); 65 v_sb.append("INSERT INTO tblpermgroups ").append("(groupname, groupdesc, grouptype)").append( 66 " VALUES ('" + in_groupName + "', '" + in_groupDesc + "', " + in_groupType + ")"); 67 68 synchronized (this) { 70 execStatement(v_sb.toString()); 71 72 String new_groupID = getMax("tblpermgroups", "groupid"); 74 v_select = "select " + new_groupID + " as GROUPID"; 75 } 76 } 77 execStatementToRS(v_select); 78 } 79 } | Popular Tags |