online.sanen.unabo.sql.pipe.DebugPileline Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of unabo Show documentation
Show all versions of unabo Show documentation
Unabo, the Java™ progressive ORM framework
The newest version!
package online.sanen.unabo.sql.pipe;
import com.mhdt.Print;
import com.mhdt.toolkit.DateUtility;
import online.sanen.unabo.api.Handel;
import online.sanen.unabo.api.structure.ChannelContext;
import online.sanen.unabo.sql.Assembler;
/**
* @author LazyToShow
* Date: Dec 6, 2018
* Time: 6:16:58 PM
*/
public class DebugPileline implements SimplePileline, Handel {
@Override
public Object handel(ChannelContext context, Object product) {
Assembler.instance().threadLocalPut("lastSQL", context.isSqlFormat() ? formatSql(context) : this.getSql(context));
if (context.isShowSql()) {
StringBuilder sb = new StringBuilder();
Assembler.instance().threadLocalPut("sb", sb);
sb.append("\r\n");
sb.append(String.format("[%s][%s :%s][%s][%s]", DateUtility.getNow("HH:mm:ss.ms"), context.productType(), context.getId(), Thread.currentThread().getName(), context.productType()));
sb.append("\r\n");
sb.append(context.isSqlFormat() ? formatSql(context) : this.getSql(context));
sb.append("\r\n");
sb.append("----------------------------------------------------------------------------------------------");
sb.append("\r\n");
}
if (context.isLog()) {
// Todo Provide an external log output interface
}
return null;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy