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

io.vertx.ext.asyncsql.impl.MySQLConnectionImpl Maven / Gradle / Ivy

There is a newer version: 3.6.0
Show newest version
package io.vertx.ext.asyncsql.impl;

import com.github.mauricio.async.db.Connection;
import com.github.mauricio.async.db.QueryResult;
import com.github.mauricio.async.db.mysql.MySQLQueryResult;
import io.vertx.core.json.JsonArray;
import io.vertx.ext.asyncsql.impl.pool.AsyncConnectionPool;
import io.vertx.ext.sql.UpdateResult;
import scala.concurrent.ExecutionContext;

/**
 * @author Joern Bernhardt.
 */
public class MySQLConnectionImpl extends AsyncSQLConnectionImpl {
  public MySQLConnectionImpl(Connection conn, AsyncConnectionPool pool, ExecutionContext ec) {
    super(conn, pool, ec);
  }

  @Override
  protected UpdateResult queryResultToUpdateResult(QueryResult qr) {
    int affected = (int)qr.rowsAffected();
    MySQLQueryResult mySQLQueryResult = (MySQLQueryResult) qr;
    return new UpdateResult(affected, new JsonArray().add(mySQLQueryResult.lastInsertId()));
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy