01: package com.teamkonzept.webman.mainint.db.queries.duplication.oracle;
02:
03: import com.teamkonzept.db.*;
04: import com.teamkonzept.webman.mainint.DatabaseDefaults;
05:
06: import java.io.*;
07: import java.util.*;
08: import java.sql.*;
09:
10: import oracle.jdbc.driver.*;
11:
12: /**
13: @author Marwan
14: */
15: public class SelectDuplicationResults extends TKCallableQuery implements
16: QueryConstants {
17:
18: public final static boolean isPrepared = true;
19:
20: public final static String[] paramOrder = { "DUMMY", /* damit die :1 von execute() 'uebersprungen' wird */
21: TKDBDuplicateQuery.TEMPLATE_ROOT_ID,
22: TKDBDuplicateQuery.ST_SUBTREE_ROOT_ID };
23:
24: public final static Object[][] paramTypes = null;
25:
26: public final static boolean[] setRelevants = null;
27:
28: public final static String sqlString =
29:
30: /* "{ ? = call duplication.select_results() }"; */
31:
32: " begin :1 := duplication.select_results(:2,:3); end; ";
33:
34: public void initQuery(Connection con) {
35: super .initQuery(con, isPrepared, paramOrder, paramTypes,
36: setRelevants, sqlString);
37:
38: CallableStatement cStmt = (CallableStatement) stmt;
39: try {
40: cStmt.registerOutParameter(1, OracleTypes.CURSOR);
41: } catch (SQLException e) {
42: throw new Error(e.getMessage());
43: }
44:
45: }
46:
47: /**
48: TKPrepQuery.specClose() is being overridden to avoid reuse of this object
49: */
50: public void specClose() throws SQLException {
51: if (stmt != null) {
52: stmt.close();
53: }
54: }
55:
56: /*
57: public boolean execute()throws SQLException{
58: CallableStatement cStmt = (CallableStatement) stmt;
59: cStmt.clearParameters();
60: try{
61: cStmt.registerOutParameter(1, OracleTypes.CURSOR);
62: }
63: catch(SQLException e){
64: throw new Error(e.getMessage());
65: }
66: return super.execute();
67: }
68: */
69: public ResultSet fetchResultSet() {
70: CallableStatement cStmt = (CallableStatement) stmt;
71: ResultSet rs;
72: try {
73: rs = (ResultSet) cStmt.getObject(1);
74: } catch (SQLException e) {
75: throw new Error(e.getMessage());
76: }
77: return rs;
78:
79: }
80: }
|