1 5 package com.teamkonzept.webman.mainint.db.queries.oracle; 6 7 import java.sql.*; 8 9 import com.teamkonzept.db.*; 10 import com.teamkonzept.webman.mainint.db.queries.properties.*; 11 import com.teamkonzept.webman.mainint.WebmanExceptionHandler; 12 13 19 public class TKDBPropNew extends TKExtendedPrepQuery 20 { 21 22 public final static boolean isPrepared = true; 23 24 public final static String [] paramOrder = { "PROP_NAME", 25 "PROP_VALUE" 26 }; 27 28 public final static Object [][] paramTypes = 29 { {"PROP_NAME", new Integer (Types.VARCHAR)}, 30 {"PROP_VALUE", new Integer (Types.LONGVARCHAR)} 31 }; 32 33 public final static boolean[] setRelevants = { true }; 34 35 54 protected static Class [] queryClasses = { 55 SelectMaxProperty.class, InsertProperty.class, SelectPropId.class }; 59 60 public boolean execute() 61 { 62 try 63 { 64 65 init(queryClasses); 67 boolean isNotOpen = aTKDBConnection.isAutoCommit(); 69 if (isNotOpen) 70 { 71 TKDBManager.beginTransaction(); } 73 74 Object propId = null; 75 queries[0].execute(); 80 ResultSet rs = queries[0].fetchResultSet(); 81 if (rs != null && rs.next()) 82 { 83 propId = rs.getObject(1); 84 } 85 86 87 queries[1].setQueryParams("PROP_ID", propId); 93 queries[1].setQueryParams("PROP_NAME", 94 queryParams.get("PROP_NAME")); 95 queries[1].setQueryParams("PROP_VALUE", 96 queryParams.get("PROP_VALUE")); 97 queries[1].execute(); 98 99 queries[2].setQueryParams("PROP_ID", propId); 105 queries[2].execute(); 106 addResult(queries[2].fetchResultSet()); 107 108 109 if (isNotOpen) 111 { 112 aTKDBConnection.commitTransaction(); } 114 115 } 116 catch(Throwable t) 117 { 118 TKDBManager.safeRollbackTransaction(t); 119 } 120 return hasResults(); 121 } 122 123 public void initQuery(Connection con) 124 { 125 super.initQuery(con, 126 isPrepared, 127 paramOrder, paramTypes, setRelevants, sqlString); 128 } 129 } 130 | Popular Tags |