I have a Result
from a jOOQ fetch()
that I turn into a Collection
and then do various manipulations on it.
I then want to turn it back into a import org.jooq.Result
. (I confess I want to do this because I want to be able to use functions like formatCSV
and
formatJSON
so if there is a better way to achieve this, I'm open to it!)
I'm having trouble figuring out how to instantiate the new result
though. I've tried several different means:
// ResultImpl cannot be resolved to a type
ResultImpl<R> newResult1 = new ResultImpl<R>( ctx.configuration(), cursorFields );
ResultImpl<Record2<Long, String>> newResult2 = new ResultImpl<Record2<Long, String>>( ctx.configuration(), cursorFields );
Result<Record2<Long, String>> newResult3 = new ResultImpl<Record2<Long, String>>();
// Cannot instantiate the type Result<Record2<Long,String>>
Result<Record2<Long, String>> newResult4 = new Result<Record2<Long, String>>();
// The type org.jooq.impl.ResultsImpl is not visible
Configuration configuration;
// ... would make sure configuration was properly initialized
Result newResult5 = new org.jooq.impl.ResultsImpl.ResultsImpl( configuration );
Any help would be appreciated!
Thanks!
edit (16-NOV-2015/9:16aEST):
Here is how I did it:
Result<Record> tempResult = null;
tempResult = getResults().into( getResults().fields() );
tempResult.clear();
for (Buffer b : bufferPrimary)
tempResult.add( b.dataRecord );
return tempResult.formatCSV();
I don't like that the tempResult gets all the records only to clear them out. Is there a way to add a .where( false )
to the .into
?