Package io.vertx.reactivex.ext.sql
Class SQLRowStream
- java.lang.Object
-
- io.vertx.reactivex.ext.sql.SQLRowStream
-
- All Implemented Interfaces:
ReadStream<JsonArray>,StreamBase
public class SQLRowStream extends Object implements ReadStream<JsonArray>
A ReadStream of Rows from the underlying RDBMS. This class follows the ReadStream semantics and will automatically close the underlying resources if all returned rows are returned. For cases where the results are ignored before the full processing of the returned rows is complete the close method **MUST** be called in order to release underlying resources. The interface is minimal in order to support all SQL clients not just JDBC. NOTE: This class has been automatically generated from theoriginalnon RX-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<SQLRowStream>__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description SQLRowStream(SQLRowStream delegate)SQLRowStream(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the stream/underlying cursor(s).voidclose(Handler<AsyncResult<Void>> handler)Closes the stream/underlying cursor(s).intcolumn(String name)Will convert the column name to the json array index.List<String>columns()Returns all column names available in the underlying resultset.SQLRowStreamendHandler(Handler<Void> endHandler)Set an end handler.booleanequals(Object o)SQLRowStreamexceptionHandler(Handler<Throwable> handler)Set an exception handler on the read stream.ReadStream<JsonArray>fetch(long amount)Fetch the specifiedamountof elements.SQLRowStreamgetDelegate()SQLRowStreamhandler(Handler<JsonArray> handler)Set a data handler.inthashCode()voidmoreResults()Request for more results if availablestatic SQLRowStreamnewInstance(SQLRowStream arg)SQLRowStreampause()Pause theReadStream, it sets the buffer infetchmode and clears the actual demand.Pipe<JsonArray>pipe()Pause this stream and return a to transfer the elements of this stream to a destination .voidpipeTo(WriteStream<JsonArray> dst)Pipe thisReadStreamto theWriteStream.voidpipeTo(WriteStream<JsonArray> dst, Handler<AsyncResult<Void>> handler)Pipe thisReadStreamto theWriteStream.SQLRowStreamresultSetClosedHandler(Handler<Void> handler)Event handler when a resultset is closed.SQLRowStreamresume()Resume reading, and sets the buffer inflowingmode.io.reactivex.CompletablerxClose()Closes the stream/underlying cursor(s).io.reactivex.CompletablerxPipeTo(WriteStream<JsonArray> dst)Pipe thisReadStreamto theWriteStream.io.reactivex.Flowable<JsonArray>toFlowable()io.reactivex.Observable<JsonArray>toObservable()StringtoString()
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<SQLRowStream> __TYPE_ARG
-
-
Constructor Detail
-
SQLRowStream
public SQLRowStream(SQLRowStream delegate)
-
SQLRowStream
public SQLRowStream(Object delegate)
-
-
Method Detail
-
getDelegate
public SQLRowStream getDelegate()
- Specified by:
getDelegatein interfaceReadStream<JsonArray>- Specified by:
getDelegatein interfaceStreamBase
-
toObservable
public io.reactivex.Observable<JsonArray> toObservable()
- Specified by:
toObservablein interfaceReadStream<JsonArray>
-
toFlowable
public io.reactivex.Flowable<JsonArray> toFlowable()
- Specified by:
toFlowablein interfaceReadStream<JsonArray>
-
fetch
public ReadStream<JsonArray> fetch(long amount)
Fetch the specifiedamountof elements. If theReadStreamhas been paused, reading will recommence with the specifiedamountof items, otherwise the specifiedamountwill be added to the current stream demand.- Specified by:
fetchin interfaceReadStream<JsonArray>- Parameters:
amount-- Returns:
- a reference to this, so the API can be used fluently
-
pipe
public Pipe<JsonArray> pipe()
Pause this stream and return a to transfer the elements of this stream to a destination . The stream will be resumed when the pipe will be wired to aWriteStream.- Specified by:
pipein interfaceReadStream<JsonArray>- Returns:
- a pipe
-
pipeTo
public void pipeTo(WriteStream<JsonArray> dst, Handler<AsyncResult<Void>> handler)
Pipe thisReadStreamto theWriteStream.Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Once this stream has ended or failed, the write stream will be ended and the
handlerwill be called with the result.- Specified by:
pipeToin interfaceReadStream<JsonArray>- Parameters:
dst- the destination write streamhandler-
-
pipeTo
public void pipeTo(WriteStream<JsonArray> dst)
Pipe thisReadStreamto theWriteStream.Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Once this stream has ended or failed, the write stream will be ended and the
handlerwill be called with the result.- Specified by:
pipeToin interfaceReadStream<JsonArray>- Parameters:
dst- the destination write stream
-
rxPipeTo
public io.reactivex.Completable rxPipeTo(WriteStream<JsonArray> dst)
Pipe thisReadStreamto theWriteStream.Elements emitted by this stream will be written to the write stream until this stream ends or fails.
Once this stream has ended or failed, the write stream will be ended and the
handlerwill be called with the result.- Specified by:
rxPipeToin interfaceReadStream<JsonArray>- Parameters:
dst- the destination write stream- Returns:
-
exceptionHandler
public SQLRowStream exceptionHandler(Handler<Throwable> handler)
Description copied from interface:ReadStreamSet an exception handler on the read stream.- Specified by:
exceptionHandlerin interfaceReadStream<JsonArray>- Specified by:
exceptionHandlerin interfaceStreamBase- Parameters:
handler- the exception handler- Returns:
- a reference to this, so the API can be used fluently
-
handler
public SQLRowStream handler(Handler<JsonArray> handler)
Description copied from interface:ReadStreamSet a data handler. As data is read, the handler will be called with the data.- Specified by:
handlerin interfaceReadStream<JsonArray>- Returns:
- a reference to this, so the API can be used fluently
-
pause
public SQLRowStream pause()
Description copied from interface:ReadStreamPause theReadStream, it sets the buffer infetchmode and clears the actual demand.While it's paused, no data will be sent to the data
handler.- Specified by:
pausein interfaceReadStream<JsonArray>- Returns:
- a reference to this, so the API can be used fluently
-
resume
public SQLRowStream resume()
Description copied from interface:ReadStreamResume reading, and sets the buffer inflowingmode. If theReadStreamhas been paused, reading will recommence on it.- Specified by:
resumein interfaceReadStream<JsonArray>- Returns:
- a reference to this, so the API can be used fluently
-
endHandler
public SQLRowStream endHandler(Handler<Void> endHandler)
Description copied from interface:ReadStreamSet an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called.- Specified by:
endHandlerin interfaceReadStream<JsonArray>- Returns:
- a reference to this, so the API can be used fluently
-
column
public int column(String name)
Will convert the column name to the json array index.- Parameters:
name- the column name- Returns:
- the json array index
-
columns
public List<String> columns()
Returns all column names available in the underlying resultset. One needs to carefully use this method since in contrast to the singular version it does not perform case insensitive lookups or takes alias in consideration on the column names.- Returns:
- the list of columns names returned by the query
-
resultSetClosedHandler
public SQLRowStream resultSetClosedHandler(Handler<Void> handler)
Event handler when a resultset is closed. This is useful to request for more results.- Parameters:
handler- called when the current result set is closed- Returns:
-
moreResults
public void moreResults()
Request for more results if available
-
close
public void close()
Closes the stream/underlying cursor(s). The actual close happens asynchronously.
-
close
public void close(Handler<AsyncResult<Void>> handler)
Closes the stream/underlying cursor(s). The actual close happens asynchronously.- Parameters:
handler- called when the stream/underlying cursor(s) is(are) closed
-
rxClose
public io.reactivex.Completable rxClose()
Closes the stream/underlying cursor(s). The actual close happens asynchronously.- Returns:
-
newInstance
public static SQLRowStream newInstance(SQLRowStream arg)
-
-