Sha256: b3007aaeb7b920f5132417ee0ae6f6011a459a77ff115aacdd60a6dacb10994c

Contents?: true

Size: 1.96 KB

Versions: 4

Compression:

Stored size: 1.96 KB

Contents

/*
package org.embulk.input.athena;

import java.util.List;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.ResultSet;

import org.embulk.input.jdbc.JdbcInputConnection;
import org.embulk.input.jdbc.JdbcLiteral;
import org.embulk.input.jdbc.getter.ColumnGetter;

public class AthenaInputConnection
        extends JdbcInputConnection
{
    public AthenaInputConnection(Connection connection)
            throws SQLException
    {
        super(connection, null);
        connection.setAutoCommit(true);
    }

    @Override
    protected BatchSelect newBatchSelect(PreparedQuery preparedQuery,
            List<ColumnGetter> getters,
            int fetchRows, int queryTimeout) throws SQLException
    {
        String query = preparedQuery.getQuery();
        List<JdbcLiteral> params = preparedQuery.getParameters();

        logger.info("SQL: " + query);
        PreparedStatement stmt = connection.prepareStatement(query, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);  // TYPE_FORWARD_ONLY and CONCUR_READ_ONLY are default
        if (!params.isEmpty()) {
            logger.info("Parameters: {}", params);
            prepareParameters(stmt, getters, params);
        }
        if (fetchRows == 1) {
            // See MySQLInputPlugin.newConnection doesn't set useCursorFetch=true when fetchRows=1
            // MySQL Connector/J keeps the connection opened and process rows one by one with Integer.MIN_VALUE.
            stmt.setFetchSize(Integer.MIN_VALUE);
        } else if (fetchRows <= 0) {
            // uses the default behavior. MySQL Connector/J fetches the all rows in memory.
        } else {
            // useCursorFetch=true is enabled. MySQL creates temporary table and uses multiple select statements to fetch rows.
            stmt.setFetchSize(fetchRows);
        }
        // Because socketTimeout is set in Connection, don't need to set quertyTimeout.
        return new SingleSelect(stmt);
    }
}
*/

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
embulk-input-athena-0.1.7 src/main/java/org/embulk/input/athena/AthenaInputConnection.java
embulk-input-athena-0.1.6 src/main/java/org/embulk/input/athena/AthenaInputConnection.java
embulk-input-athena-0.1.5 src/main/java/org/embulk/input/athena/AthenaInputConnection.java
embulk-input-athena-0.1.4 src/main/java/org/embulk/input/athena/AthenaInputConnection.java