提交 c819060d authored 作者: Thomas Mueller's avatar Thomas Mueller

Small improvements.

上级 dec7fdf7
......@@ -586,8 +586,9 @@ public class DataType {
if (list == null) {
return ValueNull.INSTANCE;
}
Value[] values = new Value[list.length];
for (int i = 0; i < list.length; i++) {
int len = list.length;
Value[] values = new Value[len];
for (int i = 0; i < len; i++) {
values[i] = DataType.convertToValue(session, list[i], Value.NULL);
}
v = ValueArray.get(values);
......
......@@ -802,8 +802,10 @@ public abstract class Value {
* 1 otherwise
*/
public final int compareTypeSave(Value v, CompareMode mode) {
if (this == ValueNull.INSTANCE) {
return v == ValueNull.INSTANCE ? 0 : -1;
if (this == v) {
return 0;
} else if (this == ValueNull.INSTANCE) {
return -1;
} else if (v == ValueNull.INSTANCE) {
return 1;
}
......
......@@ -86,8 +86,9 @@ public class ValueArray extends Value {
}
public Object getObject() {
Object[] list = new Object[values.length];
for (int i = 0; i < values.length; i++) {
int len = values.length;
Object[] list = new Object[len];
for (int i = 0; i < len; i++) {
list[i] = values[i].getObject();
}
return list;
......@@ -131,10 +132,11 @@ public class ValueArray extends Value {
if (values == v.values) {
return true;
}
if (values.length != v.values.length) {
int len = values.length;
if (len != v.values.length) {
return false;
}
for (int i = 0; i < values.length; i++) {
for (int i = 0; i < len; i++) {
if (!values[i].equals(v.values[i])) {
return false;
}
......
......@@ -60,8 +60,8 @@ public class TestCallableStatement extends TestBase {
assertEquals(1, rs.getInt(1));
assertEquals("Hello", rs.getString(2));
assertFalse(rs.next());
stat.execute("CREATE ALIAS testcall FOR \"" + getClass().getName() + ".testCall\"");
call = conn.prepareCall("{CALL testcall(?,?,?)}");
stat.execute("CREATE ALIAS testCall FOR \"" + getClass().getName() + ".testCall\"");
call = conn.prepareCall("{CALL testCall(?,?,?)}");
call.setInt("A", 100);
call.setString(2, "abc");
long t = System.currentTimeMillis();
......@@ -93,7 +93,7 @@ public class TestCallableStatement extends TestBase {
// expected exception
}
try {
call.getBoolean("ASD");
call.getBoolean("X");
fail("incorrect parameter name value");
} catch (SQLException e) {
// expected exception
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论