提交 39d9e950 authored 作者: Thomas Mueller's avatar Thomas Mueller

The SimpleResultSet now has a feature to not close the result set after reading the last row.

上级 2ac018ee
......@@ -62,6 +62,7 @@ public class SimpleResultSet implements ResultSet, ResultSetMetaData {
private boolean wasNull;
private SimpleRowSource source;
private ArrayList<Column> columns = New.arrayList();
private boolean autoClose = true;
/**
* This class holds the data of a result column.
......@@ -318,7 +319,9 @@ public class SimpleResultSet implements ResultSet, ResultSetMetaData {
return true;
}
}
if (autoClose) {
close();
}
return false;
}
......@@ -2120,4 +2123,23 @@ public class SimpleResultSet implements ResultSet, ResultSetMetaData {
}
//## Java 1.6 end ##
/**
* Set the auto-close behavior. If enabled (the default), the result set is closed
* after reading the last row.
*
* @param autoClose the new value
*/
public void setAutoClose(boolean autoClose) {
this.autoClose = autoClose;
}
/**
* Get the current auto-close behavior.
*
* @return the auto-close value
*/
public boolean getAutoClose() {
return autoClose;
}
}
......@@ -52,6 +52,7 @@ public class ValueResultSet extends Value {
ResultSetMetaData meta = rs.getMetaData();
int columnCount = meta.getColumnCount();
SimpleResultSet simple = new SimpleResultSet();
simple.setAutoClose(false);
ValueResultSet val = new ValueResultSet(simple);
for (int i = 0; i < columnCount; i++) {
String name = meta.getColumnLabel(i + 1);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论