KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > teamkonzept > publishing > markups > db > queries > TKMarkupParamDefinitionNew


1 /*
2  * $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 $
3  *
4  */

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 /**
14  * @author
15  * @version
16  */

17 public class TKMarkupParamDefinitionNew extends CompositeQuery {
18
19     Integer JavaDoc 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 JavaDoc(paramId);
39                 insert.setQueryParams("PARAMETER_ID", parameterId);
40                 select.setQueryParams("PARAMETER_ID", parameterId);
41             }
42         }
43         catch (SQLException sqle) {
44             WebmanExceptionHandler.getException(sqle);
45         }
46         return true;
47     }
48     
49 }
50
51
Popular Tags