1 32 33 package com.knowgate.projtrack; 34 35 import com.knowgate.debug.DebugFile; 36 import com.knowgate.jdc.JDCConnection; 37 import com.knowgate.dataobjs.DB; 38 import com.knowgate.dataobjs.DBBind; 39 import com.knowgate.dataobjs.DBPersist; 40 import com.knowgate.dataobjs.DBSubset; 41 42 import com.knowgate.misc.Gadgets; 43 44 import java.sql.Connection ; 45 import java.sql.SQLException ; 46 import java.sql.CallableStatement ; 47 import java.sql.PreparedStatement ; 48 import java.sql.Statement ; 49 import java.sql.ResultSet ; 50 51 public class Duty extends DBPersist { 52 53 56 public Duty() { 57 super(DB.k_duties, "Duty"); 58 } 59 60 62 65 public Duty(JDCConnection oConn, String sIdDuty) throws SQLException { 66 super(DB.k_duties,"Duty"); 67 68 Object aDuty[] = { sIdDuty }; 69 70 load (oConn,aDuty); 71 } 72 73 75 81 public boolean delete(JDCConnection oConn) throws SQLException { 82 return Duty.delete(oConn, getString(DB.gu_duty)); 83 } 84 85 87 94 public boolean store(JDCConnection oConn) throws SQLException { 95 java.sql.Timestamp dtNow = new java.sql.Timestamp (DBBind.getTime()); 96 97 if (!AllVals.containsKey(DB.gu_duty)) 98 put(DB.gu_duty, Gadgets.generateUUID()); 99 100 replace(DB.dt_modified, dtNow); 102 103 return super.store(oConn); 104 } 105 106 109 116 public static boolean delete(JDCConnection oConn, String sDutyGUID) throws SQLException { 117 boolean bRetVal; 118 119 if (oConn.getDataBaseProduct()==JDCConnection.DBMS_POSTGRESQL) { 120 if (DebugFile.trace) DebugFile.writeln("Connection.executeQuery(SELECT k_sp_del_duty ('" + sDutyGUID + "'))"); 121 Statement oStmt = oConn.createStatement(); 122 ResultSet oRSet = oStmt.executeQuery("SELECT k_sp_del_duty ('" + sDutyGUID + "')"); 123 oRSet.close(); 124 oStmt.close(); 125 bRetVal = true; 126 } 127 else { 128 if (DebugFile.trace) DebugFile.writeln("Connection.prepareCall({ call k_sp_del_duty ('" + sDutyGUID + "')})"); 129 CallableStatement oCall = oConn.prepareCall("{call k_sp_del_duty ('" + sDutyGUID + "')}"); 130 bRetVal = oCall.execute(); 131 oCall.close(); 132 } 133 134 return bRetVal; 135 } 137 140 public static final short ClassId = 81; 141 } | Popular Tags |