// Path: common-db/src/main/java/org/simpleflatmapper/db/ConnectionParam.java
// @State(Scope.Benchmark)
// public class ConnectionParam {
//     @Param(value="H2")
//     public DbTarget db;
// 
//     public DataSource dataSource;
// 
//     public Connection connection;
// 
//     @Setup
//     public void init() throws SQLException, NamingException {
//         dataSource = ConnectionHelper.getDataSource(db);
// 
//         if (db != DbTarget.MOCK) {
//             Connection conn = dataSource.getConnection();
//             try {
//                 ConnectionHelper.createTableAndInsertData(conn, ConnectionHelper.Table.SMALL);
//                 ConnectionHelper.createTableAndInsertData(conn, ConnectionHelper.Table.BIG);
//             } finally {
//                 conn.close();
//             }
//         }
//         connection = dataSource.getConnection();
// 
//         // Create initial context
//         System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
//                 InitialContextFactory.class.getName());
//         InitialContext ic = new InitialContext();
// 
//         ic.bind("java:datasource", dataSource);
// 
//     }
// 
//     public Connection getConnection() throws SQLException {
//         return dataSource.getConnection();
//     }
// 
//     public void executeStatement(String statement, ResultSetHandler handler, Object... params) throws Exception {
//         PreparedStatement prepareStatement = connection.prepareStatement(statement);
//         try {
//             setParams(prepareStatement, params);
//             ResultSet rs = prepareStatement.executeQuery();
//             try {
//                 handler.handle(rs);
//             }finally {
//                 rs.close();
//             }
//         } finally {
//             prepareStatement.close();
//         }
//     }
// 
//     public void setParams(PreparedStatement prepareStatement, Object[] params) throws SQLException {
//         if (params != null) {
//             for(int i = 0; i < params.length; i++) {
//                 prepareStatement.setObject(i + 1, params[i]);
//             }
//         }
//     }
// }


import org.apache.ibatis.session.ResultContext;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.infra.Blackhole;
import org.simpleflatmapper.db.ConnectionParam;
import org.simpleflatmapper.db.DbTarget;
import org.simpleflatmapper.param.LimitParam;
package org.simpleflatmapper.mybatis;



@State(Scope.Benchmark)
public class MyBatisBenchmark  {


	private SqlSessionFactory sqlSessionFactory;
	@Param(value="MOCK")
	DbTarget db;
	
	@Setup
	public void init() throws Exception  {
// Path: common-db/src/main/java/org/simpleflatmapper/db/ConnectionParam.java
// @State(Scope.Benchmark)
// public class ConnectionParam {
//     @Param(value="H2")
//     public DbTarget db;
// 
//     public DataSource dataSource;
// 
//     public Connection connection;
// 
//     @Setup
//     public void init() throws SQLException, NamingException {
//         dataSource = ConnectionHelper.getDataSource(db);
// 
//         if (db != DbTarget.MOCK) {
//             Connection conn = dataSource.getConnection();
//             try {
//                 ConnectionHelper.createTableAndInsertData(conn, ConnectionHelper.Table.SMALL);
//                 ConnectionHelper.createTableAndInsertData(conn, ConnectionHelper.Table.BIG);
//             } finally {
//                 conn.close();
//             }
//         }
//         connection = dataSource.getConnection();
// 
//         // Create initial context
//         System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
//                 InitialContextFactory.class.getName());
//         InitialContext ic = new InitialContext();
// 
//         ic.bind("java:datasource", dataSource);
// 
//     }
// 
//     public Connection getConnection() throws SQLException {
//         return dataSource.getConnection();
//     }
// 
//     public void executeStatement(String statement, ResultSetHandler handler, Object... params) throws Exception {
//         PreparedStatement prepareStatement = connection.prepareStatement(statement);
//         try {
//             setParams(prepareStatement, params);
//             ResultSet rs = prepareStatement.executeQuery();
//             try {
//                 handler.handle(rs);
//             }finally {
//                 rs.close();
//             }
//         } finally {
//             prepareStatement.close();
//         }
//     }
// 
//     public void setParams(PreparedStatement prepareStatement, Object[] params) throws SQLException {
//         if (params != null) {
//             for(int i = 0; i < params.length; i++) {
//                 prepareStatement.setObject(i + 1, params[i]);
//             }
//         }
//     }
// }


// Path: mybatis/src/main/java/org/simpleflatmapper/mybatis/MyBatisBenchmark.java
import org.apache.ibatis.session.ResultContext;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.infra.Blackhole;
import org.simpleflatmapper.db.ConnectionParam;
import org.simpleflatmapper.db.DbTarget;
import org.simpleflatmapper.param.LimitParam;

package org.simpleflatmapper.mybatis;



@State(Scope.Benchmark)
public class MyBatisBenchmark  {


	private SqlSessionFactory sqlSessionFactory;
	@Param(value="MOCK")
	DbTarget db;
	
	@Setup
	public void init() throws Exception  {
		ConnectionParam connParam = new ConnectionParam();