Skip to content

Commit

Permalink
[CUBRIDQA-1240] Added the showTrace option to SystemModel to refrain …
Browse files Browse the repository at this point in the history
…from converting numeric values to '?' for show trace when set to true
  • Loading branch information
junsklee committed Nov 27, 2024
1 parent 781832f commit 565006c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions CTP/sql/configuration/System.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
<useMonitor>false</useMonitor>
<jdbcPath>/data/home/bu1/CUBRID/jdbc/cubrid_jdbc.jar</jdbcPath>
<queryPlan>false</queryPlan>
<showTrace>false</showTrace>
<errorMessage>false</errorMessage>
</system>
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public class SystemModel {

private boolean queryPlan;

private boolean showTrace;

private boolean cpResultToRemoteHost;

private boolean errorMessage;
Expand Down Expand Up @@ -119,6 +121,14 @@ public void setQueryPlan(boolean queryPlan) {
this.queryPlan = queryPlan;
}

public boolean isShowTrace() {
return showTrace;
}

public void setShowTrace(boolean showTrace) {
this.showTrace = showTrace;
}

public String getRemoteHost() {
return remoteHost;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -900,11 +900,18 @@ private void getResult(ResultSet rs, Sql sql) {
} catch (Exception e) {
}
}

SystemModel systemModel =
(SystemModel)
XstreamHelper.fromXml(
EnvGetter.getenv("CTP_HOME")
+ File.separator
+ "sql/configuration/System.xml");
String script = sql.getScript().trim().toUpperCase();
if (script.startsWith("SHOW TRACE")) {
String res = ret.toString();
res = res.replaceAll("[0-9]+", "?");
if (!systemModel.isShowTrace()) {
res = res.replaceAll("[0-9]+", "?");
}
sql.setResult(sql.getResult() + res + System.getProperty("line.separator"));
} else {
sql.setResult(sql.getResult() + ret.toString() + System.getProperty("line.separator"));
Expand Down

0 comments on commit 565006c

Please sign in to comment.