// select
SQL sqlSelect=new SQLImpl("select cfid,name from "+PREFIX+"_"+strType+"_data where expires<=?"
,new SQLItem[]{
new SQLItemImpl(System.currentTimeMillis(),Types.VARCHAR)
});
QueryImpl query;
try{
query = new QueryImpl(ThreadLocalPageContext.get(),dc,sqlSelect,-1,-1,-1,"query");
}
catch(Throwable t){
// possible that the table not exist, if not there is nothing to clean
return;
}
int recordcount=query.getRecordcount();
String cfid,name;
for(int row=1;row<=recordcount;row++){
cfid=Caster.toString(query.getAt(KeyConstants._cfid, row, null),null);
name=Caster.toString(query.getAt(KeyConstants._name, row, null),null);
if(listener!=null)listener.doEnd(engine, cleaner,name, cfid);
ScopeContext.info(log,"remove "+strType+"/"+name+"/"+cfid+" from datasource "+dc.getDatasource().getName());
engine.remove(type,name,cfid);
SQLImpl sql = new SQLImpl("delete from "+StorageScopeDatasource.PREFIX+"_"+strType+"_data where cfid=? and name=?",new SQLItem[]{
new SQLItemImpl(cfid,Types.VARCHAR),
new SQLItemImpl(name,Types.VARCHAR)
});
new QueryImpl(ThreadLocalPageContext.get(),dc,sql,-1,-1,-1,"query");
}
}