Changeset: a418afda6b21 for monetdb-java
URL: https://dev.monetdb.org/hg/monetdb-java/rev/a418afda6b21
Modified Files:
src/main/java/org/monetdb/client/JdbcClient.java
src/main/java/org/monetdb/util/CmdLineOpts.java
Branch: monetdbs
Log Message:
Suppress jdbcclient warnings about unknown .monetdb settings
diffs (75 lines):
diff --git a/src/main/java/org/monetdb/client/JdbcClient.java
b/src/main/java/org/monetdb/client/JdbcClient.java
--- a/src/main/java/org/monetdb/client/JdbcClient.java
+++ b/src/main/java/org/monetdb/client/JdbcClient.java
@@ -190,6 +190,13 @@ public final class JdbcClient {
"statements read. Batching can greatly speedup
the " +
"process of restoring a database dump.");
+// This file can contain defaults for the flags user, password, language,
+// database, save_history, format, host, port, and width. For example, an
+
+ copts.addIgnored("save_history");
+ copts.addIgnored("format");
+ copts.addIgnored("width");
+
// we store user and password in separate variables in order to
// be able to properly act on them like forgetting the password
// from the user's file if the user supplies a username on the
@@ -325,11 +332,9 @@ public final class JdbcClient {
// make sure the driver class is loaded (and thus
register itself with the DriverManager)
Class.forName("org.monetdb.jdbc.MonetDriver");
- con = DriverManager.getConnection(
- "jdbc:monetdb://" + host + "/" +
database + attr,
- user,
- pass
- );
+ String url = "jdbc:monetdb://" + host + "/" + database
+ attr;
+ System.err.println(url);
+ con = DriverManager.getConnection(url, user, pass);
SQLWarning warn = con.getWarnings();
while (warn != null) {
System.err.println("Connection warning: " +
warn.getMessage());
diff --git a/src/main/java/org/monetdb/util/CmdLineOpts.java
b/src/main/java/org/monetdb/util/CmdLineOpts.java
--- a/src/main/java/org/monetdb/util/CmdLineOpts.java
+++ b/src/main/java/org/monetdb/util/CmdLineOpts.java
@@ -10,11 +10,13 @@ package org.monetdb.util;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Properties;
public final class CmdLineOpts {
/** the arguments we handle */
private HashMap<String, OptionContainer> opts = new HashMap<String,
OptionContainer>();
+ private final HashSet<String> ignoredInFile = new HashSet<>();
/** the options themself */
private ArrayList<OptionContainer> options = new
ArrayList<OptionContainer>();
@@ -53,6 +55,10 @@ public final class CmdLineOpts {
opts.put(longa, oc);
}
+ public void addIgnored(String name) {
+ ignoredInFile.add(name);
+ }
+
public void removeOption(final String name) {
final OptionContainer oc = opts.get(name);
if (oc != null) {
@@ -88,10 +94,11 @@ public final class CmdLineOpts {
if (option != null) {
option.resetArguments();
option.addArgument(prop.getProperty(key));
- } else
+ } else if (!ignoredInFile.contains(key)) {
// ignore unknown options (it used to
throw an OptionsException)
- System.out.println("Info: Ignoring
unknown/unsupported option (in " + file.getAbsolutePath() + "): " + key);
- }
+ System.out.println("Info: Ignoring unknown/unsupported
option (in " + file.getAbsolutePath() + "): " + key);
+ }
+ }
} catch (java.io.IOException e) {
throw new OptionsException("File IO Exception: " + e);
}
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]