提交 72f706f5 authored 作者: Noel Grandin's avatar Noel Grandin

#429: Tables not found : Fix some turkish locale bugs around uppercasing

上级 790cf87b
...@@ -21,6 +21,8 @@ Change Log ...@@ -21,6 +21,8 @@ Change Log
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul> <ul>
<li>#429: Tables not found : Fix some turkish locale bugs around uppercasing
</li>
<li>Fixed bug in metadata locking, obscure combination of DDL and SELECT SEQUENCE.NEXTVAL required <li>Fixed bug in metadata locking, obscure combination of DDL and SELECT SEQUENCE.NEXTVAL required
</li> </li>
<li>Added index hints: SELECT * FROM TEST USE INDEX (idx1, idx2) <li>Added index hints: SELECT * FROM TEST USE INDEX (idx1, idx2)
......
...@@ -28,6 +28,7 @@ import org.h2.table.RegularTable; ...@@ -28,6 +28,7 @@ import org.h2.table.RegularTable;
import org.h2.table.Table; import org.h2.table.Table;
import org.h2.table.TableLink; import org.h2.table.TableLink;
import org.h2.util.New; import org.h2.util.New;
import org.h2.util.StringUtils;
/** /**
* A schema as created by the SQL statement * A schema as created by the SQL statement
...@@ -359,7 +360,7 @@ public class Schema extends DbObjectBase { ...@@ -359,7 +360,7 @@ public class Schema extends DbObjectBase {
private String getUniqueName(DbObject obj, private String getUniqueName(DbObject obj,
Map<String, ? extends SchemaObject> map, String prefix) { Map<String, ? extends SchemaObject> map, String prefix) {
String hash = Integer.toHexString(obj.getName().hashCode()).toUpperCase(); String hash = StringUtils.toUpperEnglish(Integer.toHexString(obj.getName().hashCode()));
String name = null; String name = null;
synchronized (temporaryUniqueNames) { synchronized (temporaryUniqueNames) {
for (int i = 1, len = hash.length(); i < len; i++) { for (int i = 1, len = hash.length(); i < len; i++) {
......
...@@ -383,7 +383,7 @@ public class Column { ...@@ -383,7 +383,7 @@ public class Column {
while (true) { while (true) {
ValueUuid uuid = ValueUuid.getNewRandom(); ValueUuid uuid = ValueUuid.getNewRandom();
String s = uuid.getString(); String s = uuid.getString();
s = s.replace('-', '_').toUpperCase(); s = StringUtils.toUpperEnglish(s.replace('-', '_'));
sequenceName = "SYSTEM_SEQUENCE_" + s; sequenceName = "SYSTEM_SEQUENCE_" + s;
if (schema.findSequence(sequenceName) == null) { if (schema.findSequence(sequenceName) == null) {
break; break;
......
...@@ -23,7 +23,6 @@ import java.sql.SQLException; ...@@ -23,7 +23,6 @@ import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import java.sql.Types; import java.sql.Types;
import java.util.ArrayList; import java.util.ArrayList;
import org.h2.api.ErrorCode; import org.h2.api.ErrorCode;
import org.h2.engine.Constants; import org.h2.engine.Constants;
import org.h2.engine.SysProperties; import org.h2.engine.SysProperties;
...@@ -354,7 +353,7 @@ public class Csv implements SimpleRowSource { ...@@ -354,7 +353,7 @@ public class Csv implements SimpleRowSource {
if (v.length() == 0) { if (v.length() == 0) {
v = "COLUMN" + list.size(); v = "COLUMN" + list.size();
} else if (!caseSensitiveColumnNames && isSimpleColumnName(v)) { } else if (!caseSensitiveColumnNames && isSimpleColumnName(v)) {
v = v.toUpperCase(); v = StringUtils.toUpperEnglish(v);
} }
list.add(v); list.add(v);
if (endOfLine) { if (endOfLine) {
......
...@@ -17,7 +17,6 @@ import java.util.Currency; ...@@ -17,7 +17,6 @@ import java.util.Currency;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import java.util.Locale; import java.util.Locale;
import java.util.TimeZone; import java.util.TimeZone;
import org.h2.api.ErrorCode; import org.h2.api.ErrorCode;
import org.h2.message.DbException; import org.h2.message.DbException;
...@@ -126,7 +125,7 @@ public class ToChar { ...@@ -126,7 +125,7 @@ public class ToChar {
String nlsParam) { String nlsParam) {
// short-circuit logic for formats that don't follow common logic below // short-circuit logic for formats that don't follow common logic below
String formatUp = format != null ? format.toUpperCase() : null; String formatUp = format != null ? StringUtils.toUpperEnglish(format) : null;
if (formatUp == null || formatUp.equals("TM") || formatUp.equals("TM9")) { if (formatUp == null || formatUp.equals("TM") || formatUp.equals("TM9")) {
String s = number.toPlainString(); String s = number.toPlainString();
return s.startsWith("0.") ? s.substring(1) : s; return s.startsWith("0.") ? s.substring(1) : s;
...@@ -428,7 +427,7 @@ public class ToChar { ...@@ -428,7 +427,7 @@ public class ToChar {
private static String toHex(BigDecimal number, String format) { private static String toHex(BigDecimal number, String format) {
boolean fillMode = !format.toUpperCase().startsWith("FM"); boolean fillMode = !StringUtils.toUpperEnglish(format).startsWith("FM");
boolean uppercase = !format.contains("x"); boolean uppercase = !format.contains("x");
boolean zeroPadded = format.startsWith("0"); boolean zeroPadded = format.startsWith("0");
int digits = 0; int digits = 0;
...@@ -445,7 +444,7 @@ public class ToChar { ...@@ -445,7 +444,7 @@ public class ToChar {
hex = StringUtils.pad("", digits + 1, "#", true); hex = StringUtils.pad("", digits + 1, "#", true);
} else { } else {
if (uppercase) { if (uppercase) {
hex = hex.toUpperCase(); hex = StringUtils.toUpperEnglish(hex);
} }
if (zeroPadded) { if (zeroPadded) {
hex = StringUtils.pad(hex, digits, "0", false); hex = StringUtils.pad(hex, digits, "0", false);
...@@ -654,7 +653,7 @@ public class ToChar { ...@@ -654,7 +653,7 @@ public class ToChar {
cal.get(Calendar.DAY_OF_MONTH))); cal.get(Calendar.DAY_OF_MONTH)));
i += 2; i += 2;
} else if ((cap = containsAt(format, i, "DY")) != null) { } else if ((cap = containsAt(format, i, "DY")) != null) {
String day = new SimpleDateFormat("EEE").format(ts).toUpperCase(); String day = StringUtils.toUpperEnglish(new SimpleDateFormat("EEE").format(ts));
output.append(cap.apply(day)); output.append(cap.apply(day));
i += 2; i += 2;
} else if ((cap = containsAt(format, i, "DAY")) != null) { } else if ((cap = containsAt(format, i, "DAY")) != null) {
...@@ -936,7 +935,7 @@ public class ToChar { ...@@ -936,7 +935,7 @@ public class ToChar {
} }
switch (this) { switch (this) {
case UPPERCASE: case UPPERCASE:
return s.toUpperCase(); return StringUtils.toUpperEnglish(s);
case LOWERCASE: case LOWERCASE:
return s.toLowerCase(); return s.toLowerCase();
case CAPITALIZE: case CAPITALIZE:
......
...@@ -13,6 +13,7 @@ import java.sql.Statement; ...@@ -13,6 +13,7 @@ import java.sql.Statement;
import java.sql.Types; import java.sql.Types;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Arrays; import java.util.Arrays;
import java.util.Locale;
import org.h2.test.TestBase; import org.h2.test.TestBase;
import org.h2.tools.SimpleResultSet; import org.h2.tools.SimpleResultSet;
...@@ -144,6 +145,9 @@ public class TestCompatibilityOracle extends TestBase { ...@@ -144,6 +145,9 @@ public class TestCompatibilityOracle extends TestBase {
} }
private void testToDate() throws SQLException { private void testToDate() throws SQLException {
if (Locale.getDefault() != Locale.ENGLISH) {
return;
}
deleteDb("oracle"); deleteDb("oracle");
Connection conn = getConnection("oracle;MODE=Oracle"); Connection conn = getConnection("oracle;MODE=Oracle");
Statement stat = conn.createStatement(); Statement stat = conn.createStatement();
......
...@@ -1300,6 +1300,9 @@ public class TestFunctions extends TestBase implements AggregateFunction { ...@@ -1300,6 +1300,9 @@ public class TestFunctions extends TestBase implements AggregateFunction {
} }
private void testToDate() throws ParseException { private void testToDate() throws ParseException {
if (Locale.getDefault() != Locale.ENGLISH) {
return;
}
final int month = Calendar.getInstance().get(Calendar.MONTH); final int month = Calendar.getInstance().get(Calendar.MONTH);
...@@ -1543,7 +1546,7 @@ public class TestFunctions extends TestBase implements AggregateFunction { ...@@ -1543,7 +1546,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
expected = expected.substring(0, 1).toUpperCase() + expected.substring(1); expected = expected.substring(0, 1).toUpperCase() + expected.substring(1);
String spaces = " "; String spaces = " ";
String first9 = (expected + spaces).substring(0, 9); String first9 = (expected + spaces).substring(0, 9);
assertResult(first9.toUpperCase(), assertResult(StringUtils.toUpperEnglish(first9),
stat, "SELECT TO_CHAR(X, 'DAY') FROM T"); stat, "SELECT TO_CHAR(X, 'DAY') FROM T");
assertResult(first9, assertResult(first9,
stat, "SELECT TO_CHAR(X, 'Day') FROM T"); stat, "SELECT TO_CHAR(X, 'Day') FROM T");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论