提交 043f1fc0 authored 作者: Thomas Mueller's avatar Thomas Mueller

Linked tables / MS SQL Server: if the tables were created in mixed case in MS…

Linked tables / MS SQL Server: if the tables were created in mixed case in MS SQL Server, then the identifiers in the linked tables were case sensitive (in H2).
上级 83579e6f
...@@ -54,6 +54,7 @@ public class TableLink extends Table { ...@@ -54,6 +54,7 @@ public class TableLink extends Table {
private DbException connectException; private DbException connectException;
private boolean storesLowerCase; private boolean storesLowerCase;
private boolean storesMixedCase; private boolean storesMixedCase;
private boolean storesMixedCaseQuoted;
private boolean supportsMixedCaseIdentifiers; private boolean supportsMixedCaseIdentifiers;
private boolean globalTemporary; private boolean globalTemporary;
private boolean readOnly; private boolean readOnly;
...@@ -100,6 +101,7 @@ public class TableLink extends Table { ...@@ -100,6 +101,7 @@ public class TableLink extends Table {
DatabaseMetaData meta = conn.getConnection().getMetaData(); DatabaseMetaData meta = conn.getConnection().getMetaData();
storesLowerCase = meta.storesLowerCaseIdentifiers(); storesLowerCase = meta.storesLowerCaseIdentifiers();
storesMixedCase = meta.storesMixedCaseIdentifiers(); storesMixedCase = meta.storesMixedCaseIdentifiers();
storesMixedCaseQuoted = meta.storesMixedCaseQuotedIdentifiers();
supportsMixedCaseIdentifiers = meta.supportsMixedCaseIdentifiers(); supportsMixedCaseIdentifiers = meta.supportsMixedCaseIdentifiers();
ResultSet rs = meta.getTables(null, originalSchema, originalTable, null); ResultSet rs = meta.getTables(null, originalSchema, originalTable, null);
if (rs.next() && rs.next()) { if (rs.next() && rs.next()) {
...@@ -304,6 +306,9 @@ public class TableLink extends Table { ...@@ -304,6 +306,9 @@ public class TableLink extends Table {
} else if (storesMixedCase && !supportsMixedCaseIdentifiers) { } else if (storesMixedCase && !supportsMixedCaseIdentifiers) {
// TeraData // TeraData
columnName = StringUtils.toUpperEnglish(columnName); columnName = StringUtils.toUpperEnglish(columnName);
} else if (storesMixedCase && storesMixedCaseQuoted) {
// MS SQL Server (identifiers are case insensitive even if quoted)
columnName = StringUtils.toUpperEnglish(columnName);
} }
return columnName; return columnName;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论