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.
/** * @author <a href="http://www.campudus.com">Joern Bernhardt</a>. */
public class MySQLConnectionImpl extends AsyncSQLConnectionImpl { public MySQLConnectionImpl(Connection conn, AsyncConnectionPool pool, ExecutionContext ec) { super(conn, pool, ec); } @Override protected String getStartTransactionStatement() { return "BEGIN"; } @Override protected UpdateResult queryResultToUpdateResult(QueryResult qr) { int affected = (int)qr.rowsAffected(); MySQLQueryResult mySQLQueryResult = (MySQLQueryResult) qr; return new UpdateResult(affected, new JsonArray().add(mySQLQueryResult.lastInsertId())); } }