io.vertx.rxjava.mssqlclient.MSSQLConnection Maven / Gradle / Ivy
/*
 * 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 io.vertx.rxjava.mssqlclient;
import rx.Observable;
import rx.Single;
import io.vertx.rx.java.RxHelper;
import io.vertx.rx.java.WriteStreamSubscriber;
import io.vertx.rx.java.SingleOnSubscribeAdapter;
import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.Iterator;
import java.util.function.Function;
import java.util.stream.Collectors;
import io.vertx.core.Handler;
import io.vertx.core.AsyncResult;
import io.vertx.core.json.JsonObject;
import io.vertx.core.json.JsonArray;
import io.vertx.lang.rx.RxGen;
import io.vertx.lang.rx.TypeArg;
import io.vertx.lang.rx.MappingIterator;
/**
 * A connection to Microsoft SQL Server.
 *
 * 
 * NOTE: This class has been automatically generated from the {@link io.vertx.mssqlclient.MSSQLConnection original} non RX-ified interface using Vert.x codegen.
 */
@RxGen(io.vertx.mssqlclient.MSSQLConnection.class)
public class MSSQLConnection extends io.vertx.rxjava.sqlclient.SqlConnection {
  @Override
  public String toString() {
    return delegate.toString();
  }
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    MSSQLConnection that = (MSSQLConnection) o;
    return delegate.equals(that.delegate);
  }
  
  @Override
  public int hashCode() {
    return delegate.hashCode();
  }
  public static final TypeArg __TYPE_ARG = new TypeArg<>(    obj -> new MSSQLConnection((io.vertx.mssqlclient.MSSQLConnection) obj),
    MSSQLConnection::getDelegate
  );
  private final io.vertx.mssqlclient.MSSQLConnection delegate;
  
  public MSSQLConnection(io.vertx.mssqlclient.MSSQLConnection delegate) {
    super(delegate);
    this.delegate = delegate;
  }
  public MSSQLConnection(Object delegate) {
    super((io.vertx.mssqlclient.MSSQLConnection)delegate);
    this.delegate = (io.vertx.mssqlclient.MSSQLConnection)delegate;
  }
  public io.vertx.mssqlclient.MSSQLConnection getDelegate() {
    return delegate;
  }
  /**
   * Create a connection to SQL Server with the given connectOptions.
   * @param vertx the vertx instance
   * @param connectOptions the options for the connection
   * @param handler the handler called with the connection or the failure
   */
  public static void connect(io.vertx.rxjava.core.Vertx vertx, io.vertx.mssqlclient.MSSQLConnectOptions connectOptions, io.vertx.core.Handler> handler) { 
    io.vertx.mssqlclient.MSSQLConnection.connect(vertx.getDelegate(), connectOptions, new Handler>() {
      public void handle(AsyncResult ar) {
        if (ar.succeeded()) {
          handler.handle(io.vertx.core.Future.succeededFuture(io.vertx.rxjava.mssqlclient.MSSQLConnection.newInstance((io.vertx.mssqlclient.MSSQLConnection)ar.result())));
        } else {
          handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
        }
      }
    });
  }
  /**
   * Create a connection to SQL Server with the given connectOptions.
   * @param vertx the vertx instance
   * @param connectOptions the options for the connection
   */
  public static void connect(io.vertx.rxjava.core.Vertx vertx, io.vertx.mssqlclient.MSSQLConnectOptions connectOptions) {
    connect(vertx, connectOptions, ar -> { });
  }
    /**
   * Create a connection to SQL Server with the given connectOptions.
   * @param vertx the vertx instance
   * @param connectOptions the options for the connection
   * @return 
   */
  public static rx.Single rxConnect(io.vertx.rxjava.core.Vertx vertx, io.vertx.mssqlclient.MSSQLConnectOptions connectOptions) { 
    return Single.create(new SingleOnSubscribeAdapter<>(fut -> {
      connect(vertx, connectOptions, fut);
    }));
  }
  /**
   * Like {@link io.vertx.rxjava.mssqlclient.MSSQLConnection#connect} with options built from connectionUri.
   * @param vertx 
   * @param connectionUri 
   * @param handler 
   */
  public static void connect(io.vertx.rxjava.core.Vertx vertx, java.lang.String connectionUri, io.vertx.core.Handler> handler) { 
    io.vertx.mssqlclient.MSSQLConnection.connect(vertx.getDelegate(), connectionUri, new Handler>() {
      public void handle(AsyncResult ar) {
        if (ar.succeeded()) {
          handler.handle(io.vertx.core.Future.succeededFuture(io.vertx.rxjava.mssqlclient.MSSQLConnection.newInstance((io.vertx.mssqlclient.MSSQLConnection)ar.result())));
        } else {
          handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
        }
      }
    });
  }
  /**
   * Like {@link io.vertx.rxjava.mssqlclient.MSSQLConnection#connect} with options built from connectionUri.
   * @param vertx 
   * @param connectionUri 
   */
  public static void connect(io.vertx.rxjava.core.Vertx vertx, java.lang.String connectionUri) {
    connect(vertx, connectionUri, ar -> { });
  }
    /**
   * Like {@link io.vertx.rxjava.mssqlclient.MSSQLConnection#connect} with options built from connectionUri.
   * @param vertx 
   * @param connectionUri 
   * @return 
   */
  public static rx.Single rxConnect(io.vertx.rxjava.core.Vertx vertx, java.lang.String connectionUri) { 
    return Single.create(new SingleOnSubscribeAdapter<>(fut -> {
      connect(vertx, connectionUri, fut);
    }));
  }
  /**
   * 
   * @param s 
   * @param handler 
   * @return 
   */
  public io.vertx.rxjava.mssqlclient.MSSQLConnection prepare(java.lang.String s, io.vertx.core.Handler> handler) { 
    delegate.prepare(s, new Handler>() {
      public void handle(AsyncResult ar) {
        if (ar.succeeded()) {
          handler.handle(io.vertx.core.Future.succeededFuture(io.vertx.rxjava.sqlclient.PreparedStatement.newInstance((io.vertx.sqlclient.PreparedStatement)ar.result())));
        } else {
          handler.handle(io.vertx.core.Future.failedFuture(ar.cause()));
        }
      }
    });
    return this;
  }
  /**
   * 
   * @param s 
   * @return 
   */
  public io.vertx.rxjava.mssqlclient.MSSQLConnection prepare(java.lang.String s) {
    return 
prepare(s, ar -> { });
  }
    /**
   * 
   * @param s 
   * @return 
   */
  public rx.Single rxPrepare(java.lang.String s) { 
    return Single.create(new SingleOnSubscribeAdapter<>(fut -> {
      prepare(s, fut);
    }));
  }
  /**
   * 
   * @param handler 
   * @return 
   */
  public io.vertx.rxjava.mssqlclient.MSSQLConnection exceptionHandler(io.vertx.core.Handler handler) { 
    delegate.exceptionHandler(handler);
    return this;
  }
  /**
   * 
   * @param handler 
   * @return 
   */
  public io.vertx.rxjava.mssqlclient.MSSQLConnection closeHandler(io.vertx.core.Handler handler) { 
    delegate.closeHandler(handler);
    return this;
  }
  /**
   * Cast a  to {@link io.vertx.rxjava.mssqlclient.MSSQLConnection}.
   *
   * This is mostly useful for Vert.x generated APIs like RxJava/Mutiny.
   * @param sqlConnection the connection to cast
   * @return a {@link io.vertx.rxjava.mssqlclient.MSSQLConnection instance}
   */
  public static io.vertx.rxjava.mssqlclient.MSSQLConnection cast(io.vertx.rxjava.sqlclient.SqlConnection sqlConnection) { 
    io.vertx.rxjava.mssqlclient.MSSQLConnection ret = io.vertx.rxjava.mssqlclient.MSSQLConnection.newInstance((io.vertx.mssqlclient.MSSQLConnection)io.vertx.mssqlclient.MSSQLConnection.cast(sqlConnection.getDelegate()));
    return ret;
  }
  public static MSSQLConnection newInstance(io.vertx.mssqlclient.MSSQLConnection arg) {
    return arg != null ? new MSSQLConnection(arg) : null;
  }
}
                   © 2015 - 2025 Weber Informatics LLC | Privacy Policy