KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > webman > content > db > queries > TKDBContentAttributeDelete


1 package de.webman.content.db.queries;
2
3 import de.webman.content.db.queries.DeleteContentAttrValueByValue;
4 import de.webman.content.db.queries.DeleteContentAttrByValue;
5
6 import com.teamkonzept.db.*;
7 import java.sql.*;
8
9 /**
10  * <pre>
11  * Used Queries:
12  * {@link de.webman.content.db.queries.DeleteContentAttrValueByValue DeleteContentAttrValueByValue}
13  * {@link de.webman.content.db.queries.DeleteContentAttrByValue DeleteContentAttrByValue}
14  * Params:
15  * {"VALUE_ID"}
16  * </pre>
17  * @author markus
18  * @version
19  */

20 public class TKDBContentAttributeDelete extends TKExtendedPrepQuery {
21
22     public final static boolean ISPREPARED = true;
23     public final static String JavaDoc[] PARAMORDER = { "VALUE_ID" };
24     public final static Object JavaDoc[][] PARAMTYPES = null;
25     public final static boolean[] SETRELEVANTS = { false };
26
27         protected static Class JavaDoc[] queryClasses = {
28         DeleteContentAttrValueByValue.class, // [0]
29
DeleteContentAttrByValue.class, // [1]
30
};
31
32     public boolean execute()
33     {
34     try
35     {
36
37         init(queryClasses); // init query objects
38

39         // BEGIN TRANSACTION
40
boolean isNotOpen = aTKDBConnection.isAutoCommit();
41         if (isNotOpen)
42         {
43         TKDBManager.beginTransaction(); // begin transaction
44
}
45
46         // [0]
47
queries[0].setQueryParams("VALUE_ID", queryParams.get("VALUE_ID"));
48         queries[0].execute();
49         // [1]
50
queries[1].setQueryParams("VALUE_ID", queryParams.get("VALUE_ID"));
51         queries[1].execute();
52
53         // COMMIT TRANSACTION
54
if (isNotOpen)
55         {
56         aTKDBConnection.commitTransaction(); // commit all changes
57
}
58
59     }
60     catch(Throwable JavaDoc t)
61     {
62         TKDBManager.safeRollbackTransaction(t);
63     }
64     return hasResults();
65     }
66
67     public void initQuery(Connection con) {
68     super.initQuery(
69             con,
70             ISPREPARED,
71             PARAMORDER,
72             PARAMTYPES,
73             SETRELEVANTS,
74             null );
75     }
76 }
77
Popular Tags