prepSelectMapBlock=conn.prepareStatement("select data from map m inner join block b on m.block = b.id where m.lob = ? and m.seq = ?");
PreparedStatementprep=prepared.get(sql);
prepSelectBlock=conn.prepareStatement("select data from block where id = ?");
if(prep==null){
prepDeleteLob=conn.prepareStatement("delete from lob where id = ?");
prep=conn.prepareStatement(sql);
prepDeleteMap=conn.prepareStatement("delete from map where lob = ?");
prepared.put(sql,prep);
prepDeleteBlockUnused=conn.prepareStatement("delete from block where id in(select block from map where lob = ?) and not exists(select 1 from map where block = id and lob <> ?)");
}
returnprep;
}
}
privatevoiddeleteLob(longlob)throwsSQLException{
privatevoiddeleteLob(longlob)throwsSQLException{
// delete from map where lob = ?
PreparedStatementprep;
prepDeleteMap.setLong(1,lob);
prep=prepare(
prepDeleteMap.execute();
"DELETE FROM "+LOB_MAP+" "+
// delete from block where id in(select block from map where lob = ?)
"WHERE LOB = ?");
// and not exists(select 1 from map where block = id and lob <> ?)
prep.setLong(1,lob);
prepDeleteBlockUnused.setLong(1,lob);
prep.execute();
prepDeleteBlockUnused.setLong(2,lob);
prep=prepare(
prepDeleteBlockUnused.execute();
"DELETE FROM "+LOB_DATA+" D "+
// delete from lob where id = ?
"WHERE BLOCK IN(SELECT M.BLOCK FROM "+LOB_MAP+" M WHERE LOB = ?) "+