
com.julienviet.rxjava.pgclient.PgQuery Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vertx-pg-client Show documentation
Show all versions of vertx-pg-client Show documentation
A Postgres client for Eclipse Vert.x
The newest version!
/*
* Copyright 2014 Red Hat, Inc.
*
* Red Hat licenses this file to you under the Apache License, version 2.0
* (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package com.julienviet.rxjava.pgclient;
import java.util.Map;
import rx.Observable;
import rx.Single;
import io.vertx.ext.sql.ResultSet;
import io.vertx.core.AsyncResult;
import io.vertx.core.Handler;
/**
* The binding of a {@link com.julienviet.rxjava.pgclient.PgPreparedStatement} and a set of parameters that can be executed once.
*
*
* NOTE: This class has been automatically generated from the {@link com.julienviet.pgclient.PgQuery original} non RX-ified interface using Vert.x codegen.
*/
@io.vertx.lang.rxjava.RxGen(com.julienviet.pgclient.PgQuery.class)
public class PgQuery {
public static final io.vertx.lang.rxjava.TypeArg __TYPE_ARG = new io.vertx.lang.rxjava.TypeArg<>(
obj -> new PgQuery((com.julienviet.pgclient.PgQuery) obj),
PgQuery::getDelegate
);
private final com.julienviet.pgclient.PgQuery delegate;
public PgQuery(com.julienviet.pgclient.PgQuery delegate) {
this.delegate = delegate;
}
public com.julienviet.pgclient.PgQuery getDelegate() {
return delegate;
}
/**
* Set the query result fetch size.
*
* The default fetch size is 0
which means that all rows will be fetched at once.
*
* @param size how many items should be fetched at once
* @return a reference to this, so the API can be used fluently
*/
public PgQuery fetch(int size) {
delegate.fetch(size);
return this;
}
/**
* @return true if the query is in progress and has more results to fetch
*/
public boolean inProgress() {
boolean ret = delegate.inProgress();
return ret;
}
/**
* @return true if the query execution is has been completed.
*/
public boolean completed() {
boolean ret = delegate.completed();
return ret;
}
/**
* Executes the query, the handler
will be called when the result set is available or
* if an error occurs.
*
* Setting a fetch size positive value N
asks Postgres to send at most N
rows.
* When the query is executed the method {@link com.julienviet.rxjava.pgclient.PgQuery#inProgress} ()} tells wether
* there is remaining data to fetch or not.
*
* Additional unfetched data shall be fetch using extra calls execute
until the result set is complete.
*
* @param handler the handler to call back
*/
public void execute(Handler> handler) {
delegate.execute(handler);
}
/**
* Executes the query, the handler
will be called when the result set is available or
* if an error occurs.
*
* Setting a fetch size positive value N
asks Postgres to send at most N
rows.
* When the query is executed the method {@link com.julienviet.rxjava.pgclient.PgQuery#inProgress} ()} tells wether
* there is remaining data to fetch or not.
*
* Additional unfetched data shall be fetch using extra calls execute
until the result set is complete.
*
* @return
*/
public Single rxExecute() {
return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> {
execute(fut);
}));
}
/**
* When the query is managing a cursor, the corresponding resources is released. You don't need
* to close the query when the query was executed fully.
*/
public void close() {
delegate.close();
}
/**
* Like {@link com.julienviet.rxjava.pgclient.PgQuery#close} but with a completion handler to be notified of the result.
* @param completionHandler
*/
public void close(Handler> completionHandler) {
delegate.close(completionHandler);
}
/**
* Like {@link com.julienviet.rxjava.pgclient.PgQuery#close} but with a completion handler to be notified of the result.
* @return
*/
public Single rxClose() {
return Single.create(new io.vertx.rx.java.SingleOnSubscribeAdapter<>(fut -> {
close(fut);
}));
}
public static PgQuery newInstance(com.julienviet.pgclient.PgQuery arg) {
return arg != null ? new PgQuery(arg) : null;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy