Sha256: fb6d0e0aeaf9e98aba6a5cf18d68075f5bf726db2ffe96f6d91a630c06066c40

Contents?: true

Size: 1.12 KB

Versions: 12

Compression:

Stored size: 1.12 KB

Contents

package org.embulk.input.jdbc.getter;

import java.sql.ResultSet;
import java.sql.SQLException;
import org.embulk.spi.Column;
import org.embulk.spi.PageBuilder;
import org.embulk.spi.type.Type;
import org.embulk.spi.type.Types;

public class BooleanColumnGetter
        extends AbstractColumnGetter
{
    private boolean value;

    public BooleanColumnGetter(PageBuilder to, Type toType)
    {
        super(to, toType);
    }

    @Override
    protected void fetch(ResultSet from, int fromIndex) throws SQLException
    {
        value = from.getBoolean(fromIndex);
    }

    @Override
    protected Type getDefaultToType()
    {
        return Types.BOOLEAN;
    }

    @Override
    public void booleanColumn(Column column)
    {
        to.setBoolean(column, value);
    }

    @Override
    public void longColumn(Column column)
    {
        to.setLong(column, value ? 1L : 0L);
    }

    @Override
    public void doubleColumn(Column column)
    {
        to.setDouble(column, value ? 1.0 : 0.0);
    }

    @Override
    public void stringColumn(Column column)
    {
        to.setString(column, Boolean.toString(value));
    }

}

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
embulk-input-jdbc-0.8.0 src/main/java/org/embulk/input/jdbc/getter/BooleanColumnGetter.java
embulk-input-jdbc-0.7.4 src/main/java/org/embulk/input/jdbc/getter/BooleanColumnGetter.java
embulk-input-jdbc-0.7.3 src/main/java/org/embulk/input/jdbc/getter/BooleanColumnGetter.java
embulk-input-jdbc-0.7.2 src/main/java/org/embulk/input/jdbc/getter/BooleanColumnGetter.java
embulk-input-jdbc-0.7.1 src/main/java/org/embulk/input/jdbc/getter/BooleanColumnGetter.java
embulk-input-jdbc-0.7.0 src/main/java/org/embulk/input/jdbc/getter/BooleanColumnGetter.java
embulk-input-jdbc-0.6.4 src/main/java/org/embulk/input/jdbc/getter/BooleanColumnGetter.java
embulk-input-jdbc-0.6.3 src/main/java/org/embulk/input/jdbc/getter/BooleanColumnGetter.java
embulk-input-jdbc-0.6.2 src/main/java/org/embulk/input/jdbc/getter/BooleanColumnGetter.java
embulk-input-jdbc-0.6.1 src/main/java/org/embulk/input/jdbc/getter/BooleanColumnGetter.java
embulk-input-jdbc-0.6.0 src/main/java/org/embulk/input/jdbc/getter/BooleanColumnGetter.java
embulk-input-jdbc-0.5.0 src/main/java/org/embulk/input/jdbc/getter/BooleanColumnGetter.java