提交 0476f080 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Use Arrays.copyOf() in ValueResultSet and fix compareTypeSafe()

上级 3488d9e6
...@@ -9,6 +9,7 @@ import java.sql.PreparedStatement; ...@@ -9,6 +9,7 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.ResultSetMetaData; import java.sql.ResultSetMetaData;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.Arrays;
import org.h2.engine.SessionInterface; import org.h2.engine.SessionInterface;
import org.h2.message.DbException; import org.h2.message.DbException;
import org.h2.result.ResultInterface; import org.h2.result.ResultInterface;
...@@ -91,12 +92,7 @@ public class ValueResultSet extends Value { ...@@ -91,12 +92,7 @@ public class ValueResultSet extends Value {
} }
result.reset(); result.reset();
for (int i = 0; i < maxrows && result.next(); i++) { for (int i = 0; i < maxrows && result.next(); i++) {
Value[] list = new Value[columnCount]; simple.addRow(Arrays.copyOf(result.currentRow(), columnCount));
for (int j = 0; j < columnCount; j++) {
Value[] row = result.currentRow();
list[j] = row[j];
}
simple.addRow(list);
} }
return new ValueResultSet(simple); return new ValueResultSet(simple);
} }
...@@ -141,7 +137,7 @@ public class ValueResultSet extends Value { ...@@ -141,7 +137,7 @@ public class ValueResultSet extends Value {
@Override @Override
public int compareTypeSafe(Value v, CompareMode mode) { public int compareTypeSafe(Value v, CompareMode mode) {
return this == v ? 0 : super.toString().compareTo(v.toString()); return this == v ? 0 : getString().compareTo(v.getString());
} }
@Override @Override
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论