01: /*
02: * $Header: /cvsroot/webman-cms/source/webman/com/teamkonzept/field/db/queries/TKDBFormDelete.java,v 1.6 2001/10/15 09:58:27 markus Exp $
03: *
04: */
05: /**
06: * Jedes Selectstatement erhaelt eine eigene Klasse
07: */package com.teamkonzept.field.db.queries;
08:
09: import java.sql.*;
10:
11: import com.teamkonzept.db.*;
12: import com.teamkonzept.webman.mainint.db.queries.field.*;
13: import com.teamkonzept.webman.mainint.WebmanExceptionHandler;
14:
15: /**
16: * @author
17: * @version
18: */
19: public class TKDBFormDelete extends TKExtendedPrepQuery {
20:
21: public final static boolean ISPREPARED = true;
22:
23: public final static String[] PARAMORDER = { "FORM_ID", "FORM_ID" };
24:
25: public final static Object[][] PARAMTYPESLOCAL = null;
26:
27: public final static boolean[] SETRELEVANTS = { false };
28:
29: protected static Class[] queryClasses = {
30: DeleteStructuredContent.class, DeleteForm.class };
31:
32: public boolean execute() {
33: try {
34: init(queryClasses); // init query objects
35:
36: boolean isNotOpen = aTKDBConnection.isAutoCommit();
37: if (isNotOpen) {
38: TKDBManager.beginTransaction();
39: }
40:
41: Object formId = queryParams.get("FORM_ID");
42:
43: queries[0].setQueryParams("FORM_ID", formId);
44: queries[0].execute(); // execute first query
45:
46: queries[1].setQueryParams("FORM_ID", formId);
47: queries[1].execute(); // ...and execute it
48:
49: if (isNotOpen) {
50: aTKDBConnection.commitTransaction();
51: }
52:
53: } catch (Throwable t) {
54: TKDBManager.safeRollbackTransaction(t);
55: }
56: return hasResults();
57: }
58:
59: public void initQuery(Connection con) {
60: super.initQuery(con, ISPREPARED, PARAMORDER, PARAMTYPESLOCAL,
61: SETRELEVANTS, null);
62: }
63: }
|