01: package de.webman.acl.db.queries;
02:
03: import java.sql.Connection;
04: import java.sql.Types;
05: import java.sql.SQLException;
06: import com.teamkonzept.db.*;
07: import com.teamkonzept.webman.mainint.db.queries.accesscontrol.*;
08: import com.teamkonzept.webman.mainint.WebmanExceptionHandler;
09:
10: /**
11: * $Header: /cvsroot/webman-cms/source/webman/de/webman/acl/db/queries/EventDelete.java,v 1.2 2001/09/19 11:51:38 markus Exp $
12: *
13: * @version 0.10
14: * @since 0.10
15: * @author © 2000 Team-Konzept
16: */
17: public class EventDelete extends TKExtendedPrepQuery {
18:
19: // Constants
20:
21: public static final String[] ORDER = { "WM_EVENT_ID", "WM_EVENT_ID" };
22:
23: public static final Object[][] TYPES = {
24: { "WM_EVENT_ID", new Integer(Types.INTEGER) },
25: { "WM_EVENT_ID", new Integer(Types.INTEGER) } };
26:
27: public static final boolean[] RELEVANTS = { false };
28:
29: /* public static final String SQL = (new StringBuffer()).append("DELETE FROM WM_ACTION_EVENT WHERE WM_EVENT_ID = ? ")
30: .append("DELETE FROM WM_EVENT WHERE WM_EVENT_ID = ?")
31: .toString(); */
32:
33: public static final String SQL = null;
34:
35: protected static Class[] queryClasses = {
36: DeleteWMActionEvent.class, DeleteWMEvent.class };
37:
38: // Method implementations
39:
40: public boolean execute() {
41: try {
42: init(queryClasses);
43:
44: boolean isNotOpen = aTKDBConnection.isAutoCommit();
45: if (isNotOpen) {
46: aTKDBConnection.beginTransaction();
47: }
48:
49: queries[0].setQueryParams("WM_EVENT_ID", queryParams
50: .get("WM_EVENT_ID"));
51: queries[0].execute(); // execute first query
52:
53: queries[1].setQueryParams("WM_EVENT_ID", queryParams
54: .get("WM_EVENT_ID"));
55: queries[1].execute(); // ...and execute it
56:
57: if (isNotOpen) {
58: aTKDBConnection.commitTransaction();
59: }
60: } catch (SQLException sqle) {
61: WebmanExceptionHandler.getException(sqle);
62: try {
63: aTKDBConnection.rollbackTransaction();
64: } catch (SQLException sqle2) {
65: WebmanExceptionHandler.getException(sqle2);
66: }
67: } finally {
68: return hasResults();
69: }
70: }
71:
72: public void initQuery(Connection connection) {
73: super .initQuery(connection, true, ORDER, TYPES, RELEVANTS, SQL);
74: }
75:
76: }
|