Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/main/java/io/mo/db/Executor.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ public void run(TestScript script) {
if (resultSet != null) {
RSSet rsSet = new RSSet(resultSet, command);
StmtResult actResult = new StmtResult(rsSet);
actResult.setCommand(command);
command.setActResult(actResult);
command.getTestResult().setActResult(actResult.toString());
// expResult is already fully processed in ResultParser.parseCommand
Expand Down Expand Up @@ -467,9 +468,12 @@ public boolean genRS(TestScript script) {
StmtResult actResult = new StmtResult(rsSet);
actResult.setCommand(command);
rs_writer.write(command.getCommand().trim());
rs_writer.newLine();
writeRegexPatterns(rs_writer, command);
rs_writer.write(actResult.toString());
String resultText = actResult.toString();
if (resultText != null) {
rs_writer.newLine();
rs_writer.write(resultText);
}

if (j < commands.size() - 1)
rs_writer.newLine();
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/io/mo/result/StmtResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ public void setCommand(SqlCommand command) {
this.command = command;
if (this.rsSet != null) {
connectSetAndCommand();
if (isEmptyShowNodeListResult()) {
this.type = RESULT.STMT_RESULT_TYPE_NONE;
}
}
}

Expand All @@ -158,4 +161,17 @@ else if (this.type == RESULT.STMT_RESULT_TYPE_ABNORMAL)
return expectRSText;
}

private boolean isEmptyShowNodeListResult() {
if (command == null || rsSet == null || rsSet.getMeta() == null) {
return false;
}
String sql = command.getCommand();
if (sql == null || !sql.toLowerCase().contains("show node list")) {
return false;
}
return rsSet.getRows().isEmpty()
&& rsSet.getMeta().getColumnCount() == 1
&& "1".equals(rsSet.getMeta().getColumnLable(0).trim());
}

}
Loading