[#843] Add Factory.fetch(ResultSet) to transform a JDBC ResultSet into a jOOQ Result
This commit is contained in:
parent
1fd4df3ffd
commit
06d358c588
@ -44,6 +44,7 @@ import java.math.BigInteger;
|
||||
import java.sql.Connection;
|
||||
import java.sql.Date;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Time;
|
||||
@ -64,6 +65,7 @@ import org.jooq.DataType;
|
||||
import org.jooq.DeleteQuery;
|
||||
import org.jooq.DeleteWhereStep;
|
||||
import org.jooq.Field;
|
||||
import org.jooq.FieldProvider;
|
||||
import org.jooq.Identity;
|
||||
import org.jooq.Insert;
|
||||
import org.jooq.InsertQuery;
|
||||
@ -1176,6 +1178,19 @@ public class Factory implements Configuration {
|
||||
return new SQLResultQuery(this, sql, bindings).fetchOne();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch all data from a JDBC {@link ResultSet} and transform it to a jOOQ
|
||||
* {@link Result}. After fetching all data, the JDBC ResultSet will be
|
||||
* closed.
|
||||
*
|
||||
* @param rs The JDBC ResultSet to fetch data from
|
||||
* @return The resulting jOOQ Result
|
||||
*/
|
||||
public final Result<Record> fetch(ResultSet rs) throws SQLException {
|
||||
FieldProvider fields = new MetaDataFieldProvider(this, rs.getMetaData());
|
||||
return new CursorImpl<Record>(this, fields, rs).fetchResult();
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Global Condition factory
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
Loading…
Reference in New Issue
Block a user