1 5 package com.teamkonzept.publishing.markups.db.queries; 6 7 import java.sql.*; 8 9 import com.teamkonzept.db.*; 10 import com.teamkonzept.webman.mainint.db.queries.markups.*; 11 import com.teamkonzept.webman.mainint.WebmanExceptionHandler; 12 13 public class TKMarkupDefinitionNew extends CompositeQuery { 14 15 TKQuery selectMax = null; 16 TKQuery insert = null; 17 TKQuery select = null; 18 Integer attributeId = null; 19 20 protected void initConcreteCompositeQuery()throws SQLException { 21 selectMax = registerQuery( SelectMaxTextAttribute.class); 22 insert = registerQuery( InsertTextAttribute.class); 23 select = registerQuery( SelectTextAttribute.class); 24 } 25 26 protected boolean beforeExecution(int i) { 27 try { 28 if (getQuery(i) == insert) { 29 ResultSet rs = selectMax.fetchResultSet(); 30 int attrId = 1; 31 if (rs != null && rs.next()) { 32 attrId = rs.getInt(1) + 1; 33 } 34 attributeId = new Integer (attrId); 35 insert.setQueryParams("ATTRIBUTE_ID", attributeId); 36 select.setQueryParams("ATTRIBUTE_ID", attributeId); 37 } 38 } 39 catch (SQLException sqle) { 40 WebmanExceptionHandler.getException(sqle); 41 } 42 return true; 43 } 44 45 } 46 | Popular Tags |