提交 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
<h2>Next Version (unreleased)</h2>
<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>
<li>Added index hints: SELECT * FROM TEST USE INDEX (idx1, idx2)
......
......@@ -28,6 +28,7 @@ import org.h2.table.RegularTable;
import org.h2.table.Table;
import org.h2.table.TableLink;
import org.h2.util.New;
import org.h2.util.StringUtils;
/**
* A schema as created by the SQL statement
......@@ -359,7 +360,7 @@ public class Schema extends DbObjectBase {
private String getUniqueName(DbObject obj,
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;
synchronized (temporaryUniqueNames) {
for (int i = 1, len = hash.length(); i < len; i++) {
......
......@@ -383,7 +383,7 @@ public class Column {
while (true) {
ValueUuid uuid = ValueUuid.getNewRandom();
String s = uuid.getString();
s = s.replace('-', '_').toUpperCase();
s = StringUtils.toUpperEnglish(s.replace('-', '_'));
sequenceName = "SYSTEM_SEQUENCE_" + s;
if (schema.findSequence(sequenceName) == null) {
break;
......
......@@ -23,7 +23,6 @@ import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
import java.util.ArrayList;
import org.h2.api.ErrorCode;
import org.h2.engine.Constants;
import org.h2.engine.SysProperties;
......@@ -354,7 +353,7 @@ public class Csv implements SimpleRowSource {
if (v.length() == 0) {
v = "COLUMN" + list.size();
} else if (!caseSensitiveColumnNames && isSimpleColumnName(v)) {
v = v.toUpperCase();
v = StringUtils.toUpperEnglish(v);
}
list.add(v);
if (endOfLine) {
......
......@@ -17,7 +17,6 @@ import java.util.Currency;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.TimeZone;
import org.h2.api.ErrorCode;
import org.h2.message.DbException;
......@@ -126,7 +125,7 @@ public class ToChar {
String nlsParam) {
// 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")) {
String s = number.toPlainString();
return s.startsWith("0.") ? s.substring(1) : s;
......@@ -428,7 +427,7 @@ public class ToChar {
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 zeroPadded = format.startsWith("0");
int digits = 0;
......@@ -445,7 +444,7 @@ public class ToChar {
hex = StringUtils.pad("", digits + 1, "#", true);
} else {
if (uppercase) {
hex = hex.toUpperCase();
hex = StringUtils.toUpperEnglish(hex);
}
if (zeroPadded) {
hex = StringUtils.pad(hex, digits, "0", false);
......@@ -654,7 +653,7 @@ public class ToChar {
cal.get(Calendar.DAY_OF_MONTH)));
i += 2;
} 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));
i += 2;
} else if ((cap = containsAt(format, i, "DAY")) != null) {
......@@ -936,7 +935,7 @@ public class ToChar {
}
switch (this) {
case UPPERCASE:
return s.toUpperCase();
return StringUtils.toUpperEnglish(s);
case LOWERCASE:
return s.toLowerCase();
case CAPITALIZE:
......
......@@ -13,6 +13,7 @@ import java.sql.Statement;
import java.sql.Types;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Locale;
import org.h2.test.TestBase;
import org.h2.tools.SimpleResultSet;
......@@ -144,6 +145,9 @@ public class TestCompatibilityOracle extends TestBase {
}
private void testToDate() throws SQLException {
if (Locale.getDefault() != Locale.ENGLISH) {
return;
}
deleteDb("oracle");
Connection conn = getConnection("oracle;MODE=Oracle");
Statement stat = conn.createStatement();
......
......@@ -1300,6 +1300,9 @@ public class TestFunctions extends TestBase implements AggregateFunction {
}
private void testToDate() throws ParseException {
if (Locale.getDefault() != Locale.ENGLISH) {
return;
}
final int month = Calendar.getInstance().get(Calendar.MONTH);
......@@ -1543,7 +1546,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
expected = expected.substring(0, 1).toUpperCase() + expected.substring(1);
String spaces = " ";
String first9 = (expected + spaces).substring(0, 9);
assertResult(first9.toUpperCase(),
assertResult(StringUtils.toUpperEnglish(first9),
stat, "SELECT TO_CHAR(X, 'DAY') FROM T");
assertResult(first9,
stat, "SELECT TO_CHAR(X, 'Day') FROM T");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论