* @ejb.interface-method view-type="local"
*/
public void removeAuditEvents (String procKey) {
try {
Connection con = null;
UniversalPrepStmt prepStmt = null;
try {
con = ds.getConnection();
if (dbProperties.isMySQL()
&& dbProperties.driverMajorVersion() == 5) {
prepStmt = new UniversalPrepStmt
(ds, con, "DELETE DATAAUDITEVENTOLDDATA "
+ "FROM DATAAUDITEVENTOLDDATA, "
+ "(SELECT DBID FROM AUDITEVENTS "
+ "WHERE PROCESSKEY = ?) EVENTS "
+ "WHERE DATAAUDITEVENTOLDDATA.MAPID = EVENTS.DBID");
} else {
prepStmt = new UniversalPrepStmt
(ds, con, "DELETE FROM DataAuditEventOldData WHERE "
+ "MapId IN (SELECT DBId FROM AuditEvents "
+ "WHERE ProcessKey = ?)");
}
prepStmt.setString(1, procKey);
prepStmt.executeUpdate();
prepStmt.close ();
prepStmt = null;
if (dbProperties.isMySQL()
&& dbProperties.driverMajorVersion() == 5) {
prepStmt = new UniversalPrepStmt
(ds, con, "DELETE DATAAUDITEVENTNEWDATA "
+ "FROM DATAAUDITEVENTNEWDATA, "
+ "(SELECT DBID FROM AUDITEVENTS "
+ "WHERE PROCESSKEY = ?) EVENTS "
+ "WHERE DATAAUDITEVENTNEWDATA.MAPID = EVENTS.DBID");
} else {
prepStmt = new UniversalPrepStmt
(ds, con, "DELETE FROM DataAuditEventNewData WHERE "
+ "MapId IN (SELECT DBId FROM AuditEvents "
+ "WHERE ProcessKey = ?)");
}
prepStmt.setString(1, procKey);
prepStmt.executeUpdate();
prepStmt.close ();
prepStmt = null;
prepStmt = new UniversalPrepStmt
(ds, con, "DELETE FROM AuditEvents WHERE ProcessKey = ?");
prepStmt.setString(1, procKey);
prepStmt.executeUpdate();
} finally {
JDBCUtil.closeAll(null, prepStmt, con);
}
} catch (SQLException e) {
throw new EJBException (e);