[#7353] Let Cursor extend Formattable
This commit is contained in:
parent
e71bdc5290
commit
ea2da23dac
@ -73,7 +73,7 @@ import org.jooq.impl.DefaultRecordMapper;
|
||||
* @param <R> The cursor's record type
|
||||
* @author Lukas Eder
|
||||
*/
|
||||
public interface Cursor<R extends Record> extends Iterable<R> , AutoCloseable {
|
||||
public interface Cursor<R extends Record> extends Iterable<R>, Formattable , AutoCloseable {
|
||||
|
||||
/**
|
||||
* Get this cursor's row type.
|
||||
|
||||
1483
jOOQ/src/main/java/org/jooq/impl/AbstractCursor.java
Normal file
1483
jOOQ/src/main/java/org/jooq/impl/AbstractCursor.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -988,10 +988,10 @@ abstract class AbstractRecord extends AbstractStore implements Record {
|
||||
try {
|
||||
switch (format.recordFormat()) {
|
||||
case ARRAY:
|
||||
ResultImpl.formatJSONArray0(this, fields.fields, format, 0, writer);
|
||||
AbstractCursor.formatJSONArray0(this, fields.fields, format, 0, writer);
|
||||
break;
|
||||
case OBJECT:
|
||||
ResultImpl.formatJSONMap0(this, fields.fields, format, 0, writer);
|
||||
AbstractCursor.formatJSONMap0(this, fields.fields, format, 0, writer);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Format not supported: " + format);
|
||||
@ -1035,7 +1035,7 @@ abstract class AbstractRecord extends AbstractStore implements Record {
|
||||
log.debug("XMLFormat.header currently not supported for Record.formatXML()");
|
||||
|
||||
try {
|
||||
ResultImpl.formatXMLRecord(writer, format, 0, this, fields.fields);
|
||||
AbstractCursor.formatXMLRecord(writer, format, 0, this, fields.fields);
|
||||
}
|
||||
catch (java.io.IOException e) {
|
||||
throw new IOException("Exception while writing XML", e);
|
||||
|
||||
@ -95,7 +95,7 @@ import org.jooq.tools.jdbc.JDBCUtils;
|
||||
/**
|
||||
* @author Lukas Eder
|
||||
*/
|
||||
final class CursorImpl<R extends Record> implements Cursor<R> {
|
||||
final class CursorImpl<R extends Record> extends AbstractCursor<R> implements Cursor<R> {
|
||||
|
||||
private static final JooqLogger log = JooqLogger.getLogger(CursorImpl.class);
|
||||
|
||||
@ -126,6 +126,8 @@ final class CursorImpl<R extends Record> implements Cursor<R> {
|
||||
}
|
||||
|
||||
CursorImpl(ExecuteContext ctx, ExecuteListener listener, Field<?>[] fields, int[] internIndexes, boolean keepStatement, boolean keepResultSet, Class<? extends R> type, int maxRows) {
|
||||
super(ctx.configuration(), new Fields<R>(fields));
|
||||
|
||||
this.ctx = ctx;
|
||||
this.listener = (listener != null ? listener : ExecuteListeners.get(ctx));
|
||||
this.cursorFields = fields;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user