01: /*
02: * $Header: /cvsroot/webman-cms/source/webman/com/teamkonzept/webman/mainint/db/queries/Attic/TKDBPropDelete.java,v 1.3 2001/08/15 13:16:22 markus Exp $
03: *
04: */
05: package com.teamkonzept.webman.mainint.db.queries;
06:
07: import java.sql.*;
08:
09: import com.teamkonzept.db.*;
10: import com.teamkonzept.webman.mainint.WebmanExceptionHandler;
11: import com.teamkonzept.webman.mainint.db.queries.properties.*;
12:
13: /*
14: * TKDBPropDelete
15: * input "PROP_NAME"
16: * output nada
17: * delete entry in PROPERTIES
18: */
19: public class TKDBPropDelete extends TKExtendedPrepQuery {
20:
21: public final static boolean isPrepared = true;
22:
23: public final static String[] order = { "PROP_ID", "PROP_ID" };
24:
25: public final static Object[][] types = { { "PROP_ID",
26: new Integer(Types.INTEGER) } };
27:
28: public final static boolean[] setRelevants = { true };
29:
30: /* public final static String sqlString =
31: "BEGIN TRANSACTION " +
32:
33: "delete " +
34: "PROPERTY_GROUP_MEMBER " +
35: "where "+
36: " PROPERTY_ID = ? " +
37:
38: "delete " +
39: "PROPERTY " +
40: "where " +
41: " PROPERTY_ID = ? " +
42:
43: "COMMIT TRANSACTION " ; */
44:
45: protected static Class[] queryClasses = {
46: DeleteFromPropertyGroupMember.class,
47: DeleteFromProperty.class };
48:
49: public boolean execute() {
50: try {
51: init(queryClasses);
52:
53: boolean isNotOpen = aTKDBConnection.isAutoCommit();
54: if (isNotOpen) {
55: TKDBManager.beginTransaction();
56: }
57:
58: // DELETE PROPERTY_GROUP_MEMBER WHERE PROPERTY_ID = ?
59: queries[0].setQueryParams("PROPERTY_ID", queryParams
60: .get("PROP_ID"));
61: queries[0].execute();
62:
63: // delete PROPERTY where PROPERTY_ID = ?
64:
65: queries[1].setQueryParams("PROPERTY_ID", queryParams
66: .get("PROP_ID"));
67: queries[1].execute();
68:
69: if (isNotOpen) {
70: TKDBManager.commitTransaction();
71: }
72:
73: } catch (Throwable t) {
74: TKDBManager.safeRollbackTransaction(t);
75: }
76: return hasResults();
77: }
78:
79: public void initQuery(Connection con) {
80: super.initQuery(con, isPrepared, order, types, setRelevants,
81: sqlString);
82: }
83: }
|