Skip to content

Commit

Permalink
Make JDBC_API_Tester independent of current timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
joerivanruth committed Jan 16, 2025
1 parent 91f62e7 commit fb016c0
Showing 1 changed file with 22 additions and 23 deletions.
45 changes: 22 additions & 23 deletions tests/JDBC_API_Tester.java
Original file line number Diff line number Diff line change
Expand Up @@ -736,29 +736,10 @@ private void Test_Driver(String con_URL) {
sb.setLength(0); // clear the output log buffer

try {
final Driver driver = DriverManager.getDriver(con_URL);
DriverPropertyInfo[] props = driver.getPropertyInfo(con_URL, null);
DriverPropertyInfo prop;
final String space = " ";
for (int i = 0; i < props.length; i++) {
prop = props[i];
sb.append(i).append(space);
sb.append(prop.name).append(space);
sb.append(prop.required).append(space);
sb.append(prop.value).append(space);
sb.append(prop.description).append("\n");
}
listDriverProperties(con_URL);
// also test against monetdbs, this should make tls and cert required.
props = driver.getPropertyInfo("jdbc:monetdbs:", null);
sb.append("getPropertyInfo of jdbc:monetdbs:").append("\n");
for (int i = 0; i < props.length; i++) {
prop = props[i];
sb.append(i).append(space);
sb.append(prop.name).append(space);
sb.append(prop.required).append(space);
sb.append(prop.value).append(space);
sb.append(prop.description).append("\n");
}
listDriverProperties("jdbc:monetdbs:");
} catch (SQLException e) {
// this means we get what we expect
sb.append("failed to get Driver class: ").append(e.getMessage());
Expand All @@ -773,7 +754,7 @@ private void Test_Driver(String con_URL) {
"4 database false name of database to connect to\n" +
"5 autocommit false true initial value of autocommit\n" +
"6 schema false initial schema\n" +
"7 timezone false 60 client time zone as minutes east of UTC\n" +
"7 timezone false <tz> client time zone as minutes east of UTC\n" +
"8 replysize false 250 rows beyond this limit are retrieved on demand, <1 means unlimited\n" +
"9 debug false false enable tracing of socket communication for debugging\n" +
"10 logfile false when debug is enabled its output will be written to this logfile\n" +
Expand All @@ -796,7 +777,7 @@ private void Test_Driver(String con_URL) {
"9 clientcert false path to TLS certs for 'clientkey', if not included there\n" +
"10 autocommit false true initial value of autocommit\n" +
"11 schema false initial schema\n" +
"12 timezone false 60 client time zone as minutes east of UTC\n" +
"12 timezone false <tz> client time zone as minutes east of UTC\n" +
"13 replysize false 250 rows beyond this limit are retrieved on demand, <1 means unlimited\n" +
"14 debug false false enable tracing of socket communication for debugging\n" +
"15 logfile false when debug is enabled its output will be written to this logfile\n" +
Expand All @@ -808,6 +789,24 @@ private void Test_Driver(String con_URL) {
"21 client_remark false any client remark to send in ClientInfo\n");
}

private void listDriverProperties(String url) throws SQLException {
final Driver driver = DriverManager.getDriver(url);
DriverPropertyInfo[] props = driver.getPropertyInfo(url, null);
for (int i = 0; i < props.length; i++) {
DriverPropertyInfo prop = props[i];
final String name = prop.name;
String value = prop.value;
if (name.equals("timezone"))
value = "<tz>";
sb.append(i).append(" ");
sb.append(name).append(" ");
sb.append(prop.required).append(" ");
sb.append(value).append(" ");
sb.append(prop.description).append("\n");
}

}

private void handleExecuteDDL(Statement stmt, String action, String objtype, String objname, String sql) {
try {
int response = stmt.executeUpdate(sql);
Expand Down

0 comments on commit fb016c0

Please sign in to comment.