1 package com.teamkonzept.webman.mainint.db.queries; 2 3 import java.sql.*; 4 5 import com.teamkonzept.db.*; 6 import com.teamkonzept.webman.mainint.db.queries.sitetree.DeleteFromContentValue; 7 import com.teamkonzept.webman.mainint.db.queries.sitetree.DeleteFromContentNode; 8 9 13 public class DeleteStrucContentValue extends TKExtendedPrepQuery 14 { 15 public final static boolean IS_PREPARED = 16 true; 17 18 public final static String [] PARAM_ORDER = 19 { 20 "CONTENT_ID", "CONTENT_ID" 21 }; 22 23 public final static Object [][] PARAM_TYPES = 24 null; 25 26 public final static boolean[] SET_RELEVANTS = 27 null; 28 29 public final static String SQL_STRING = 30 " DELETE FROM CONTENT_VALUE WHERE CONTENT_ID = ? " + 31 " DELETE FROM CONTENT_NODE " + 32 " WHERE CONTENT_ID = ? " ; 33 34 protected static Class [] queryClasses = { 35 DeleteFromContentValue.class, DeleteFromContentNode.class }; 38 39 public boolean execute() 40 { 41 try 42 { 43 init(queryClasses); 45 46 Integer nodeId = (Integer ) queryParams.get("CONTENT__ID"); 47 48 boolean isNotOpen = aTKDBConnection.isAutoCommit(); 49 if (isNotOpen) 50 { 51 TKDBManager.beginTransaction(); } 53 54 queries[0].setQueryParams("CONTENT_ID", nodeId); 56 queries[0].execute(); 57 58 queries[1].setQueryParams("CONTENT_ID", nodeId); 60 queries[1].execute(); 61 62 if (isNotOpen) 64 { 65 aTKDBConnection.commitTransaction(); } 67 68 } 69 catch(Throwable t) 70 { 71 TKDBManager.safeRollbackTransaction(t); 72 } 73 return hasResults(); 74 } 75 76 public void initQuery(Connection con) { 77 super.initQuery( 78 con, 79 IS_PREPARED, 80 PARAM_ORDER, 81 PARAM_TYPES, 82 SET_RELEVANTS, 83 SQL_STRING ); 84 } 85 } 86 87 88 | Popular Tags |