mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
Merged dev into feature/join-enhancements
This commit is contained in:
@ -863,6 +863,16 @@ public abstract class AbstractRDBMSAction implements QActionInterface
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
** Make it easy (e.g., for tests) to turn on poor-man's formatting of SQL
|
||||
*******************************************************************************/
|
||||
public static void setLogSQLReformat(boolean doReformat)
|
||||
{
|
||||
System.setProperty("qqq.rdbms.logSQL.reformat", String.valueOf(doReformat));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
@ -874,6 +884,19 @@ public abstract class AbstractRDBMSAction implements QActionInterface
|
||||
{
|
||||
params = params.size() <= 100 ? params : params.subList(0, 99);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// (very very) poor man's version of sql formatting... if property is true //
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
if(System.getProperty("qqq.rdbms.logSQL.reformat", "false").equalsIgnoreCase("true"))
|
||||
{
|
||||
sql = Objects.requireNonNullElse(sql, "").toString()
|
||||
.replaceAll("FROM ", "\nFROM\n ")
|
||||
.replaceAll("INNER", "\n INNER")
|
||||
.replaceAll("LEFT", "\n LEFT")
|
||||
.replaceAll("RIGHT", "\n RIGHT")
|
||||
.replaceAll("WHERE", "\nWHERE\n ");
|
||||
}
|
||||
|
||||
if(System.getProperty("qqq.rdbms.logSQL.output", "logger").equalsIgnoreCase("system.out"))
|
||||
{
|
||||
System.out.println("SQL: " + sql);
|
||||
|
Reference in New Issue
Block a user