IDEMPIERE-4454 Implement filter for SQL debug - unify oracle and postgresql variable (#252)

This commit is contained in:
Carlos Ruiz 2020-09-17 15:02:22 +02:00 committed by GitHub
parent 6771a696cc
commit d3c9804253
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 9 deletions

View File

@ -371,7 +371,12 @@ public class DB_Oracle implements AdempiereDatabase
public String convertStatement (String oraStatement)
{
Convert.logMigrationScript(oraStatement, null);
if ("true".equals(System.getProperty("org.idempiere.db.oracle.debug"))) {
if ("true".equals(System.getProperty("org.idempiere.db.debug"))) {
String filterOrDebug = System.getProperty("org.idempiere.db.debug.filter");
boolean print = true;
if (filterOrDebug != null)
print = oraStatement.matches(filterOrDebug);
if (print)
log.warning("Oracle -> " + oraStatement);
}
return oraStatement;

View File

@ -15,7 +15,12 @@ public class Convert_Oracle extends Convert {
protected ArrayList<String> convertStatement(String sqlStatement) {
ArrayList<String> result = new ArrayList<String>();
result.add(sqlStatement);
if ("true".equals(System.getProperty("org.idempiere.db.oracle.debug"))) {
if ("true".equals(System.getProperty("org.idempiere.db.debug"))) {
String filterOrDebug = System.getProperty("org.idempiere.db.debug.filter");
boolean print = true;
if (filterOrDebug != null)
print = sqlStatement.matches(filterOrDebug);
if (print)
log.warning("Oracle -> " + sqlStatement);
}
return result;

View File

@ -355,8 +355,13 @@ public class DB_PostgreSQL implements AdempiereDatabase
String cache = convertCache.get(oraStatement);
if (cache != null) {
Convert.logMigrationScript(oraStatement, cache);
if ("true".equals(System.getProperty("org.idempiere.db.postgresql.debug"))) {
if ("true".equals(System.getProperty("org.idempiere.db.debug"))) {
String filterPgDebug = System.getProperty("org.idempiere.db.debug.filter");
boolean print = true;
if (filterPgDebug != null)
print = cache.matches(filterPgDebug);
// log.warning("Oracle -> " + oraStatement);
if (print)
log.warning("Pgsql -> " + cache);
}
return cache;

View File

@ -127,10 +127,17 @@ public class Convert_PostgreSQL extends Convert_SQL92 {
statement = recoverQuotedStrings(statement, retVars);
result.add(statement);
if ("true".equals(System.getProperty("org.idempiere.db.postgresql.debug"))) {
if ("true".equals(System.getProperty("org.idempiere.db.debug"))) {
String filterPgDebug = System.getProperty("org.idempiere.db.debug.filter");
boolean print = true;
if (filterPgDebug != null)
print = statement.matches(filterPgDebug);
// log.warning("Oracle -> " + oraStatement);
if (print) {
log.warning("Oracle -> " + sqlStatement);
log.warning("PgSQL -> " + statement);
}
}
return result;
} // convertStatement