1 package smile.stored; 2 3 import java.util.*; 4 5 import java.sql.*; 6 7 18 public class s_editGroupToPub extends StoredProcedure implements ProcedureInterface { 19 20 String in_groupID; 22 23 String in_pubID; 24 25 String in_delete; 26 27 String in_ifexists; 28 29 public s_editGroupToPub() { 30 } 31 32 public void init(HashMap initData, Connection con) { 33 super.init(initData, con); 35 in_groupID = utils.getString(data, "GROUPID", ""); 37 in_pubID = utils.getString(data, "PUBID", ""); 38 in_delete = utils.getString(data, "DELETE", ""); 39 utils.log("in-delete = " + in_delete); 40 } 41 42 public void checkAction() throws SQLException { 43 } 44 45 public void checkParams() throws SQLException { 46 } 47 48 public void executeAction() throws SQLException { 49 StringBuffer v_sbSelect = new StringBuffer (); 50 v_sbSelect.append("SELECT count(*) ").append(" FROM tblpermgrouppublication ").append(" WHERE groupID = " + in_groupID).append( 51 " AND pubID = " + in_pubID); 52 53 in_ifexists = execStatementToValue(v_sbSelect.toString()); 54 55 if (in_ifexists.equals("0")) { 56 if (in_delete.equals("0")) { 57 StringBuffer v_sb = new StringBuffer (); 58 v_sb.append("INSERT INTO tblpermgrouppublication ").append(" VALUES(" + in_groupID + "," + in_pubID + ")"); 59 60 execStatement(v_sb.toString()); 61 } 62 } 63 64 else { 65 if (Integer.parseInt(in_ifexists) > 0) { 66 if (in_delete.equals("1")) { 67 StringBuffer v_sbDelete = new StringBuffer (); 68 v_sbDelete.append("DELETE FROM tblpermgrouppublication ").append(" WHERE groupID = " + in_groupID).append(" AND pubID = " + in_pubID); 69 70 execStatement(v_sbDelete.toString()); 71 72 } 73 } 74 } 75 execStatementToRS(queryResultOk); 76 } 77 } | Popular Tags |