1 package smile.stored; 2 3 import java.util.*; 4 import java.sql.*; 5 6 17 public class s_editGroupType extends StoredProcedure implements ProcedureInterface { 18 19 String in_grouptypeID; 21 22 String in_groupTypeName; 23 24 String in_groupTypeDesc; 25 26 String in_newgrouptypeid; 27 28 public s_editGroupType() { 29 } 30 31 public void init(HashMap initData, Connection con) { 32 super.init(initData, con); 34 in_grouptypeID = utils.getString(data, "GROUPTYPEID", ""); 36 in_groupTypeName = utils.getString(data, "GROUPTYPENAME", ""); 37 in_groupTypeDesc = utils.getString(data, "GROUPTYPEDESC", ""); 38 } 39 40 public void checkParams() throws SQLException { 41 } 42 43 public void checkAction() throws SQLException { 44 if (in_grouptypeID.equals("0")) { 45 action = "insert"; 46 } else { 47 action = "update"; 48 } 49 } 50 51 public void executeAction() throws SQLException { 52 String v_select = "select 1 as returnValue"; 53 if (action.equals("update")) { 54 StringBuffer v_sb = new StringBuffer (); 55 v_sb.append("UPDATE tblpermgrouptype ").append(" SET grouptypename = '" + in_groupTypeName + "',").append( 56 " grouptypedesc = '" + in_groupTypeDesc + "'").append(" WHERE grouptypeid = " + in_grouptypeID); 57 58 execStatement(v_sb.toString()); 59 } else if (action.equals("insert")) { 60 StringBuffer v_sb = new StringBuffer (); 61 v_sb.append("INSERT INTO tblpermgrouptype ").append("(grouptypename, grouptypedesc)").append( 62 " VALUES ('" + in_groupTypeName + "', '" + in_groupTypeDesc + "')"); 63 64 execStatement(v_sb.toString()); 65 } 66 execStatementToRS(v_select); 67 } 68 } | Popular Tags |