All Downloads are FREE. Search and download functionalities are using the official Maven repository.

x-mssql-client.4.5.0.source-code.cursor.adoc Maven / Gradle / Ivy

There is a newer version: 5.0.0.CR1
Show newest version
== Cursors and streaming

include::cursor_warning.adoc[opts=optional]

By default, prepared query execution fetches all rows, you can use a
{@link io.vertx.sqlclient.Cursor} to control the amount of rows you want to read:

[source,$lang]
----
{@link examples.SqlClientExamples#usingCursors01(io.vertx.sqlclient.SqlConnection)}
----

Cursors shall be closed when they are released prematurely:

[source,$lang]
----
{@link examples.SqlClientExamples#usingCursors02(io.vertx.sqlclient.Cursor)}
----

A stream API is also available for cursors, which can be more convenient, specially with the Rxified version.

[source,$lang]
----
{@link examples.SqlClientExamples#usingCursors03(io.vertx.sqlclient.SqlConnection)}
----

The stream read the rows by batch of `50` and stream them, when the rows have been passed to the handler,
a new batch of `50` is read and so on.

The stream can be resumed or paused, the loaded rows will remain in memory until they are delivered and the cursor
will stop iterating.




© 2015 - 2024 Weber Informatics LLC | Privacy Policy