Sha256: 59468e19b78d9d34d51fea2e5e9a68bc8b9e77efa6acc6c99f9ced34246706e6
Contents?: true
Size: 966 Bytes
Versions: 24
Compression:
Stored size: 966 Bytes
Contents
package org.embulk.input.jdbc.getter; import java.sql.Date; 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 DateColumnGetter extends AbstractTimestampColumnGetter { static final String DEFAULT_FORMAT = "%Y-%m-%d"; public DateColumnGetter(PageBuilder to, Type toType, TimestampFormatter timestampFormatter) { super(to, toType, timestampFormatter); } @Override protected void fetch(ResultSet from, int fromIndex) throws SQLException { Date date = from.getDate(fromIndex); if (date != null) { value = Timestamp.ofEpochMilli(date.getTime()); } } @Override protected Type getDefaultToType() { return Types.TIMESTAMP.withFormat(DEFAULT_FORMAT); } }
Version data entries
24 entries across 24 versions & 2 rubygems