Skip to content

Commit

Permalink
Improve construction of SQL query in showTblContents()
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdvm committed Jul 31, 2024
1 parent 0a7327b commit aff47a4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/JDBC_API_Tester.java
Original file line number Diff line number Diff line change
Expand Up @@ -7268,11 +7268,12 @@ private void Test_ClientInfo(String con_URL) {

// some private utility methods for showing table content and params meta data
private void showTblContents(String tblnm) {
final String query = "SELECT * FROM \"" + tblnm + "\"";
Statement stmt = null;
ResultSet rs = null;
try {
stmt = con.createStatement();
rs = stmt.executeQuery("SELECT * FROM " + tblnm);
rs = stmt.executeQuery(query);
if (rs != null) {
ResultSetMetaData rsmd = rs.getMetaData();
sb.append("Table ").append(tblnm).append(" has ").append(rsmd.getColumnCount()).append(" columns:\n");
Expand All @@ -7287,7 +7288,7 @@ private void showTblContents(String tblnm) {
sb.append("\n");
}
} else
sb.append("failed to execute query: SELECT * FROM ").append(tblnm).append("\n");
sb.append("failed to execute query: ").append(query).append("\n");
} catch (SQLException e) {
sb.append("showContents failed: ").append(e.getMessage()).append("\n");
}
Expand Down Expand Up @@ -7385,12 +7386,12 @@ private void compareExpectedOutput(String testname, String expected) {
}
}
System.err.println();
System.err.println("---- Full Output: ---------------------------");
System.err.println("---- Full Output: ------------");
System.err.println(sb);
System.err.println("---- END --------------------------------------");
System.err.println("---- Expected Output: -------------------------");
System.err.println("---- END ---------------------");
System.err.println("---- Expected Output: --------");
System.err.println(expected);
System.err.println("---- END --------------------------------------");
System.err.println("---- END ---------------------");
System.err.println();
}
if (sb.length() > sbInitLen) {
Expand Down

0 comments on commit aff47a4

Please sign in to comment.