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