Feature request?
- Please delete the BUG REPORT FORM below and describe the feature.
- It is a good idea to discuss your changes on the mailing list to get feedback from the community. https://groups.google.com/group/mybatis-user
- If you have a patch with unit tests, send a pull request. Please see the wiki page : https://github.com/mybatis/mybatis-3/wiki/Contribute -->
now we just loop the List out of stmt (and into a List), and then handle it. but it might be memory costy, so I would like to change this part to return a Iterable or a Stream, who not do
while (rsw != null && resultMapCount > resultSetCount) {
ResultMap resultMap = resultMaps.get(resultSetCount);
handleResultSet(rsw, resultMap, multipleResults, null);
rsw = getNextResultSet(stmt);
cleanUpAfterHandlingResultSet();
resultSetCount++;
}
all at beginning, but do it when needed during the stream... I hope by doing this we can let the outer layers decide if read all, or just read some then stop, or read some skip others, and has the ability to avoid a giant List when return value is really big any +1 or -1s?
Comment From: harawata
Hello @XenoAmess ,
There already is that functionality. It's called Cursor
.
https://mybatis.org/mybatis-3/java-api.html#statement-execution-methods
Search references to org.apache.ibatis.cursor.Cursor
in the test cases.
e.g. https://github.com/mybatis/mybatis-3/blob/master/src/test/java/org/apache/ibatis/submitted/cursor_simple/CursorSimpleTest.java
p.s. Please use text instead of image whenever possible. Texts can be copied/searched/edited, images are not.
Comment From: XenoAmess
good, would have a try