打印sql⽇志
@Component
@Slf4j
public class SQLLogFilter extends FilterEventAdapter {物业经理
@Override
public boolean statement_execute(FilterChain chain, StatementProxy statement, String sql)throws SQLException {
return super.statement_execute(chain, statement, sql);
}
家常菜大全菜谱@Override
public boolean statement_execute(FilterChain chain, StatementProxy statement, String sql,int autoGeneratedKeys)throws SQLException { return super.statement_execute(chain, statement, sql, aut
oGeneratedKeys);
}
@Override
public boolean statement_execute(FilterChain chain, StatementProxy statement, String sql,int[] columnIndexes)throws SQLException { return super.statement_execute(chain, statement, sql, columnIndexes);
}
@Override
public boolean statement_execute(FilterChain chain, StatementProxy statement, String sql, String[] columnNames)throws SQLException { return super.statement_execute(chain, statement, sql, columnNames);
}
@Override
public ResultSetProxy statement_executeQuery(FilterChain chain, StatementProxy statement, String sql)throws SQLException {
return super.statement_executeQuery(chain, statement, sql);
}
@Override
public int statement_executeUpdate(FilterChain chain, StatementProxy statement, String sql)throws SQLException {
return super.statement_executeUpdate(chain, statement, sql);
}
@Override
public int statement_executeUpdate(FilterChain chain, StatementProxy statement, String sql,int autoGeneratedKeys)throws SQLException { return super.statement_executeUpdate(chain, statement, sql, autoGeneratedKeys);
标准近义词}
@Override
public int statement_executeUpdate(FilterChain chain, StatementProxy statement, String sql,int[] columnIndexes)throws SQLException { return super.statement_executeUpdate(chain, statement, sql, columnIndexes);
}
@Override
public int statement_executeUpdate(FilterChain chain, StatementProxy statement, String sql, String[] columnNames)throws SQLException { return super.statement_executeUpdate(chain, statement, sql, columnNames);
}
@Override
protected void statementExecuteUpdateBefore(StatementProxy statement, String sql){
无氧运动
super.statementExecuteUpdateBefore(statement, sql);
}
精干@Override
protected void statementExecuteQueryBefore(StatementProxy statement, String sql){
super.statementExecuteQueryBefore(statement, sql);
}
@Override
protected void statementExecuteQueryAfter(StatementProxy statement, String sql, ResultSetProxy resultSet){
super.statementExecuteQueryAfter(statement, sql, resultSet);
}
}
@Override
protected void statementExecuteBefore(StatementProxy statement, String sql){
带九的诗句
printLog(statement, sql);
super.statementExecuteBefore(statement, sql);
}
@Override
protected void statementExecuteAfter(StatementProxy statement, String sql,boolean result){
super.statementExecuteAfter(statement, sql, result);
}
@Override
protected void statement_executeErrorAfter(StatementProxy statement, String sql, Throwable error){ super.statement_executeErrorAfter(statement, sql, error);
}
@Override
xp共享
protected void statementExecuteUpdateAfter(StatementProxy statement, String sql,int updateCount){ super.statementExecuteUpdateAfter(statement, sql, updateCount);
}
private void printLog(StatementProxy statement, String sql){
Integer parameterSize = ParametersSize();
鸿门宴译文
List<Object> parameters =new ArrayList<>(parameterSize);
for(int i =0; i < parameterSize;++i){
JdbcParameter jdbcParameter = Parameter(i);
parameters.Value());
}
String dbType = ConnectionProxy().getDirectDataSource().getDbType();
String formattedSql = SQLUtils.format(sql, dbType, parameters);
formattedSql = place("\n"," ")
.replace("\r"," ")
.replace("\t","");
log.info(formattedSql);
}
}