Sha256: 8bb1c9210becf65987f4f318c5a3819bb92a28a65be4465f4900ae15b2a2f533

Contents?: true

Size: 966 Bytes

Versions: 24

Compression:

Stored size: 966 Bytes

Contents

package org.embulk.input.jdbc.getter;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Time;
import org.embulk.spi.PageBuilder;
import org.embulk.spi.time.Timestamp;
import org.embulk.spi.time.TimestampFormatter;
import org.embulk.spi.type.Type;
import org.embulk.spi.type.Types;

public class TimeColumnGetter
        extends AbstractTimestampColumnGetter
{
    static final String DEFAULT_FORMAT = "%H:%M:%S";

    public TimeColumnGetter(PageBuilder to, Type toType, TimestampFormatter timestampFormatter)
    {
        super(to, toType, timestampFormatter);
    }

    @Override
    protected void fetch(ResultSet from, int fromIndex) throws SQLException
    {
        Time time = from.getTime(fromIndex);
        if (time != null) {
            value = Timestamp.ofEpochMilli(time.getTime());
        }
    }

    @Override
    protected Type getDefaultToType()
    {
        return Types.TIMESTAMP.withFormat(DEFAULT_FORMAT);
    }

}

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
embulk-input-jdbc-0.6.2 src/main/java/org/embulk/input/jdbc/getter/TimeColumnGetter.java
embulk-input-jdbc-0.6.1 src/main/java/org/embulk/input/jdbc/getter/TimeColumnGetter.java
embulk-input-jdbc-0.6.0 src/main/java/org/embulk/input/jdbc/getter/TimeColumnGetter.java
embulk-input-jdbc-0.5.0 src/main/java/org/embulk/input/jdbc/getter/TimeColumnGetter.java