提交 7751faba authored 作者: Thomas Mueller's avatar Thomas Mueller

Pull request #146: Improved CompareMode.

上级 8c67eba9
...@@ -21,9 +21,11 @@ Change Log ...@@ -21,9 +21,11 @@ Change Log
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul> <ul>
<li>Fix for #144, JdbcResultSet.setFetchDirection() throws "Feature not supported" <li>Pull request #146: Improved CompareMode.
</li> </li>
<li>Fix for issue #143, deadlock between two sessions hitting the same sequence on a column <li>Fix for #144, JdbcResultSet.setFetchDirection() throws "Feature not supported".
</li>
<li>Fix for issue #143, deadlock between two sessions hitting the same sequence on a column.
</li> </li>
<li>Pull request #137: SourceCompiler should not throw a syntax error on javac warning. <li>Pull request #137: SourceCompiler should not throw a syntax error on javac warning.
</li> </li>
......
...@@ -102,9 +102,8 @@ public class CompareMode { ...@@ -102,9 +102,8 @@ public class CompareMode {
* @return the compare mode * @return the compare mode
*/ */
public static CompareMode getInstance(String name, int strength, boolean binaryUnsigned) { public static CompareMode getInstance(String name, int strength, boolean binaryUnsigned) {
CompareMode last; CompareMode last = lastUsed;
if (last != null) {
if ((last = lastUsed) != null) {
if (StringUtils.equals(last.name, name) && if (StringUtils.equals(last.name, name) &&
last.strength == strength && last.strength == strength &&
last.binaryUnsigned == binaryUnsigned) { last.binaryUnsigned == binaryUnsigned) {
...@@ -112,7 +111,7 @@ public class CompareMode { ...@@ -112,7 +111,7 @@ public class CompareMode {
} }
} }
if (name == null || name.equals(OFF)) { if (name == null || name.equals(OFF)) {
lastUsed = last = new CompareMode(name, strength, binaryUnsigned); last = new CompareMode(name, strength, binaryUnsigned);
} else { } else {
boolean useICU4J; boolean useICU4J;
if (name.startsWith(ICU4J)) { if (name.startsWith(ICU4J)) {
...@@ -125,11 +124,12 @@ public class CompareMode { ...@@ -125,11 +124,12 @@ public class CompareMode {
useICU4J = CAN_USE_ICU4J; useICU4J = CAN_USE_ICU4J;
} }
if (useICU4J) { if (useICU4J) {
lastUsed = last = new CompareModeIcu4J(name, strength, binaryUnsigned); last = new CompareModeIcu4J(name, strength, binaryUnsigned);
} else { } else {
lastUsed = last = new CompareModeDefault(name, strength, binaryUnsigned); last = new CompareModeDefault(name, strength, binaryUnsigned);
} }
} }
lastUsed = last;
return last; return last;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论