Sha256: 1958bb8f85475dd8393f85796bcc74854f64114a08e7fe53d8d77a5d305c2ddb
Contents?: true
Size: 1 KB
Versions: 24
Compression:
Stored size: 1 KB
Contents
package org.embulk.input.jdbc.getter; import java.sql.ResultSet; import java.sql.SQLException; 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 TimestampColumnGetter extends AbstractTimestampColumnGetter { static final String DEFAULT_FORMAT = "%Y-%m-%d %H:%M:%S"; public TimestampColumnGetter(PageBuilder to, Type toType, TimestampFormatter timestampFormatter) { super(to, toType, timestampFormatter); } @Override protected void fetch(ResultSet from, int fromIndex) throws SQLException { java.sql.Timestamp timestamp = from.getTimestamp(fromIndex); if (timestamp != null) { value = Timestamp.ofEpochSecond(timestamp.getTime() / 1000, timestamp.getNanos()); } } @Override protected Type getDefaultToType() { return Types.TIMESTAMP.withFormat(DEFAULT_FORMAT); } }
Version data entries
24 entries across 24 versions & 2 rubygems