Hello all,
thank you Sacha for your great new class SQLFormat to pretty print large
complex SQL statements.
I have used it to pretty print my log output in the IDE, and it works fine.
Here is how I used it:
I already had my own class derived from DBUtils in order to provided additional
util functions.
(just override protected DBUtils createUtils() in your DBContext class).
Then in YourDBUtils class simply override the logStatement functions as follows:
public class YourDBUtils extends DBUtils ...
@Override
protected void logQueryStatement(String sqlCmd, Object[] sqlParams)
{
sqlCmd = SqlFormat.format(sqlCmd, sqlParams);
super.logQueryStatement(sqlCmd, sqlParams);
}
@Override
protected void logUpdateStatement(String sqlCmd, Object[] sqlParams)
{
sqlCmd = SqlFormat.format(sqlCmd, sqlParams);
super.logUpdateStatement(sqlCmd, sqlParams);
}
Works great.
Regards,
Rainer