1 package transactions; 2 3 import dinamica.*; 4 5 9 public class SaveForm2 extends GenericTransaction 10 { 11 12 public int service(Recordset inputParams) throws Throwable 13 { 14 15 int rc = super.service(inputParams); 17 18 String sql = getResource("insert.sql"); 20 sql = this.getSQL(sql, inputParams); 21 22 String [] params = 24 { 25 "a_text", 26 "a_integer", 27 "a_double", 28 "a_comboid", 29 "a_date" 30 }; 31 32 Db db = getDb(); 34 db.exec(sql, inputParams, params); 35 36 Recordset detail = new Recordset(); 38 detail.append("categoryid", java.sql.Types.INTEGER); 39 40 String v[] = getRequest().getParameterValues("categoryid"); 42 for (int i=0;i<v.length;i++) 43 { 44 detail.addNew(); 45 detail.setValue("categoryid", new Integer (v[i])); 46 } 47 48 sql = getResource("insert-detail.sql"); 50 sql = this.getSQL(sql, inputParams); 51 52 String [] detParams = {"categoryid"}; 54 55 db.execBatch(sql, detail, detParams); 57 58 return rc; 60 61 } 62 63 } 64 | Popular Tags |