提交 2013ce7e authored 作者: Thomas Mueller's avatar Thomas Mueller

Creating a linked table from an MVStore database to a non-MVStore database…

Creating a linked table from an MVStore database to a non-MVStore database created a second (non-MVStore) database file.
上级 1a3c5bc5
...@@ -248,7 +248,7 @@ public class ConnectionInfo implements Cloneable { ...@@ -248,7 +248,7 @@ public class ConnectionInfo implements Cloneable {
} }
private void readSettingsFromURL() { private void readSettingsFromURL() {
DbSettings dbSettings = DbSettings.getInstance(null); DbSettings defaultSettings = DbSettings.getDefaultSettings();
int idx = url.indexOf(';'); int idx = url.indexOf(';');
if (idx >= 0) { if (idx >= 0) {
String settings = url.substring(idx + 1); String settings = url.substring(idx + 1);
...@@ -265,7 +265,7 @@ public class ConnectionInfo implements Cloneable { ...@@ -265,7 +265,7 @@ public class ConnectionInfo implements Cloneable {
String value = setting.substring(equal + 1); String value = setting.substring(equal + 1);
String key = setting.substring(0, equal); String key = setting.substring(0, equal);
key = StringUtils.toUpperEnglish(key); key = StringUtils.toUpperEnglish(key);
if (!isKnownSetting(key) && !dbSettings.containsKey(key)) { if (!isKnownSetting(key) && !defaultSettings.containsKey(key)) {
throw DbException.get(ErrorCode.UNSUPPORTED_SETTING_1, key); throw DbException.get(ErrorCode.UNSUPPORTED_SETTING_1, key);
} }
String old = prop.getProperty(key); String old = prop.getProperty(key);
...@@ -639,14 +639,11 @@ public class ConnectionInfo implements Cloneable { ...@@ -639,14 +639,11 @@ public class ConnectionInfo implements Cloneable {
} }
public DbSettings getDbSettings() { public DbSettings getDbSettings() {
DbSettings defaultSettings = DbSettings.getInstance(null); DbSettings defaultSettings = DbSettings.getDefaultSettings();
HashMap<String, String> s = null; HashMap<String, String> s = New.hashMap();
for (Object k : prop.keySet()) { for (Object k : prop.keySet()) {
String key = k.toString(); String key = k.toString();
if (!isKnownSetting(key) && defaultSettings.containsKey(key)) { if (!isKnownSetting(key) && defaultSettings.containsKey(key)) {
if (s == null) {
s = New.hashMap();
}
s.put(key, prop.getProperty(key)); s.put(key, prop.getProperty(key));
} }
} }
......
...@@ -341,19 +341,26 @@ public class DbSettings extends SettingsBase { ...@@ -341,19 +341,26 @@ public class DbSettings extends SettingsBase {
/** /**
* INTERNAL. * INTERNAL.
* Get the settings for the given properties (may be null). * Get the settings for the given properties (may not be null).
* *
* @param s the settings * @param s the settings
* @return the settings * @return the settings
*/ */
public static DbSettings getInstance(HashMap<String, String> s) { public static DbSettings getInstance(HashMap<String, String> s) {
if (s == null || s.isEmpty()) {
if (defaultSettings == null) {
defaultSettings = new DbSettings(new HashMap<String, String>());
}
return defaultSettings;
}
return new DbSettings(s); return new DbSettings(s);
} }
/**
* INTERNAL.
* Get the default settings. Those must not be modified.
*
* @return the settings
*/
public static DbSettings getDefaultSettings() {
if (defaultSettings == null) {
defaultSettings = new DbSettings(new HashMap<String, String>());
}
return defaultSettings;
}
} }
...@@ -182,7 +182,7 @@ public class Engine implements SessionFactory { ...@@ -182,7 +182,7 @@ public class Engine implements SessionFactory {
} }
} }
session.setAllowLiterals(true); session.setAllowLiterals(true);
DbSettings defaultSettings = DbSettings.getInstance(null); DbSettings defaultSettings = DbSettings.getDefaultSettings();
for (String setting : ci.getKeys()) { for (String setting : ci.getKeys()) {
if (defaultSettings.containsKey(setting)) { if (defaultSettings.containsKey(setting)) {
// database setting are only used when opening the database // database setting are only used when opening the database
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论