Executes the cursored statement with the given params
and lazily maps f
over the rows as they are streamed from the database.
Executes the cursored statement with the given params
and lazily maps f
over the rows as they are streamed from the database.
Use Parameters.of for converting the inputs into Parameters.
import com.twitter.finagle.mysql.Client; import com.twitter.finagle.mysql.CursorResult; import com.twitter.finagle.mysql.CursoredStatement.AsJava; import com.twitter.util.Future; import static com.twitter.finagle.mysql.Parameters.of; Client client = ... CursoredStatement.AsJava cursoredStatement = client .cursor("SELECT int_column FROM a_table WHERE string_column = ?") .asJava(); int rowsToFetch = 10; Future<CursorResult<Integer>> result = cursoredStatement.execute( rowsToFetch, (Row row) -> row.intOrNull("int_column"), of("cool example") );
A Java-friendly API for CursoredStatements.
These should be constructed via CursoredStatement.asJava but is package exposed for testing.