01: /*
02: * $Header: /cvsroot/webman-cms/source/webman/com/teamkonzept/publishing/markups/db/queries/TKMarkupParamDefinitionNew.java,v 1.6 2001/11/06 16:18:36 markus Exp $
03: *
04: */
05: package com.teamkonzept.publishing.markups.db.queries;
06:
07: import java.sql.*;
08:
09: import com.teamkonzept.db.*;
10: import com.teamkonzept.webman.mainint.db.queries.markups.*;
11: import com.teamkonzept.webman.mainint.WebmanExceptionHandler;
12:
13: /**
14: * @author
15: * @version
16: */
17: public class TKMarkupParamDefinitionNew extends CompositeQuery {
18:
19: Integer parameterId = null;
20: TKQuery selectMax = null;
21: TKQuery insert = null;
22: TKQuery select = null;
23:
24: protected void initConcreteCompositeQuery() throws SQLException {
25: selectMax = registerQuery(SelectMaxTextAttributeParam.class);
26: insert = registerQuery(InsertTextAttributeParam.class);
27: select = registerQuery(SelectTextAttributeParam.class);
28: }
29:
30: protected boolean beforeExecution(int i) {
31: try {
32: if (i == 1) {
33: ResultSet rs = selectMax.fetchResultSet();
34: int paramId = 1;
35: if (rs != null && rs.next()) {
36: paramId = rs.getInt(1) + 1;
37: }
38: parameterId = new Integer(paramId);
39: insert.setQueryParams("PARAMETER_ID", parameterId);
40: select.setQueryParams("PARAMETER_ID", parameterId);
41: }
42: } catch (SQLException sqle) {
43: WebmanExceptionHandler.getException(sqle);
44: }
45: return true;
46: }
47:
48: }
|