package io.vertx.ext.asyncsql.impl;
import com.github.mauricio.async.db.Connection;
import io.vertx.core.Vertx;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.asyncsql.MySQLClient;
import io.vertx.ext.asyncsql.impl.pool.AsyncConnectionPool;
import io.vertx.ext.asyncsql.impl.pool.MysqlAsyncConnectionPool;
import io.vertx.ext.sql.SQLConnection;
import scala.concurrent.ExecutionContext;
public class MYSQLClientImpl extends BaseSQLClient {
private final MysqlAsyncConnectionPool pool;
public MYSQLClientImpl(Vertx vertx, JsonObject globalConfig) {
super(vertx, globalConfig);
pool = new MysqlAsyncConnectionPool(vertx, globalConfig, getConnectionConfiguration(
MySQLClient.DEFAULT_HOST,
MySQLClient.DEFAULT_PORT,
MySQLClient.DEFAULT_DATABASE,
MySQLClient.DEFAULT_USER,
MySQLClient.DEFAULT_PASSWORD,
MySQLClient.DEFAULT_CHARSET,
MySQLClient.DEFAULT_CONNECT_TIMEOUT,
MySQLClient.DEFAULT_TEST_TIMEOUT,
globalConfig));
}
@Override
protected AsyncConnectionPool pool() {
return pool;
}
@Override
protected SQLConnection createFromPool(Connection conn, AsyncConnectionPool pool, ExecutionContext ec) {
return new MySQLConnectionImpl(conn, pool, ec);
}
}