1 package com.teamkonzept.webman.mainint.db.queries.oracle; 2 import java.sql.*; 3 import com.teamkonzept.db.*; 4 import com.teamkonzept.webman.mainint.db.queries.content.*; 5 import com.teamkonzept.webman.mainint.db.queries.oracle.helper. 6 CheckTableExistence; 7 import com.teamkonzept.webman.mainint.WebmanExceptionHandler; 8 9 15 public class TKDBContentTreeDeleteDependentDC extends TKExtendedPrepQuery 16 { 17 public final static boolean isPrepared = true; 18 19 public final static String [] paramOrder = { "CONTENT_NODE_ID" }; 20 21 public final static Object [][] types = null; 22 23 public final static boolean[] setRelevants = { false }; 24 25 89 90 91 protected static Class [] queryClasses = { 92 CheckTableExistence.class, CreateTempTableContentNodeId.class, SelectLeftRightNrFromContentTree.class, InsertIntoTempTableContentNodeId.class, DeleteFromContentSelection2.class, DeleteFromDocumentContent2.class }; 99 100 public boolean execute() 101 { 102 try 103 { 104 105 init(queryClasses); 107 Object contentNodeId = queryParams.get("CONTENT_NODE_ID"); 108 109 boolean isNotOpen = aTKDBConnection.isAutoCommit(); 110 if (isNotOpen) 111 { 112 TKDBManager.beginTransaction(); } 114 115 queries[0].setQueryParams("TABLE_NAME", "WEBMAN_TEMP"); queries[0].execute(); 120 ResultSet exist = queries[0].fetchResultSet(); 121 if (exist != null && exist.next()) 122 { 123 } 124 else 125 { 126 queries[1].execute(); 128 } 129 130 131 queries[2].setQueryParams("NODE_ID", contentNodeId); 137 queries[2].execute(); 138 ResultSet rs2 = queries[2].fetchResultSet(); 139 Object leftNr = null; 140 Object rightNr = null; 141 if (rs2 != null && rs2.next()) 142 { 143 leftNr = rs2.getObject(1); 144 rightNr = rs2.getObject(2); 145 } 146 147 148 queries[3].setQueryParams("LEFT_NR", leftNr); 154 queries[3].setQueryParams("RIGHT_NR", rightNr); 155 queries[3].execute(); 156 157 158 queries[4].execute(); 163 164 165 queries[5].execute(); 170 171 if (isNotOpen) 173 { 174 aTKDBConnection.commitTransaction(); } 176 177 } 178 catch(Throwable t) 179 { 180 TKDBManager.safeRollbackTransaction(t); 181 } 182 return hasResults(); 183 } 184 185 public void initQuery(Connection con) 186 { 187 super.initQuery(con, 188 isPrepared, paramOrder, types, setRelevants, null); 189 } 190 } 191 | Popular Tags |