Simple SQL Operations

There are times when you will want to run a single SQL operation, e.g.: a single select of a row, or a update to a
set of rows which do not require to be part of a transaction or have dependencies on the previous or next operation.

For these cases, clients provide a boilerplate-less API SQLOperations. This interface will
perform the following steps for you:

You can also retrieve the rows as a list of Json object instances with getRows -
this can give you a somewhat simpler API to work with, but please be aware that SQL results can contain duplicate
column names - if that’s the case you should use getResults instead.

Here’s an example of iterating through the results as Json object instances:

Multiple ResultSet responses

In some cases your query might return more than one result set, in this case and to preserve the compatibility when
the returned result set object is converted to pure json, the next result sets are chained to the current result set
under the property next. A simple walk of all result sets can be achieved like this:

Streaming

When dealing with large data sets, it is not advised to use API just described but to stream data since it avoids
inflating the whole response into memory and JSON and data is just processed on a row by row basis, for example:

You still have full control on when the stream is pauses, resumed and ended. For cases where your query returns
multiple result sets you should use the result set ended event to fetch the next one if available. If there is more
data the stream handler will receive the new data, otherwise the end handler is invoked.