Sha256: 23675f214e62f15670636686a9fd36e53bf5670e1c4bef20af85db143b2464d2

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 KB

Contents

package org.embulk.input.mysql.getter;

import org.embulk.input.jdbc.getter.ColumnGetter;
import org.joda.time.DateTimeZone;

import java.sql.Timestamp;

public class MySQLTimestampTimestampIncrementalHandler
        extends AbstractMySQLTimestampIncrementalHandler
{
    public MySQLTimestampTimestampIncrementalHandler(DateTimeZone sessionTimeZone, ColumnGetter next)
    {
        super(sessionTimeZone, next);
    }

    @Override
    public String getTimestampFormat()
    {
        return "%Y-%m-%dT%H:%M:%S.%6NZ";
    }

    @Override
    public org.embulk.spi.time.Timestamp utcTimestampFromSessionTime(long epochSecond, int nano)
    {
        long sec = sessionTimeZone.convertLocalToUTC(epochSecond * 1000, false) / 1000;
        return org.embulk.spi.time.Timestamp.ofEpochSecond(sec, nano);
    }

    @Override
    public String getTimestampPattern()
    {
        return "%Y-%m-%dT%H:%M:%S.%N%z";
    }

    @Override
    public Timestamp utcTimestampToSessionTime(org.embulk.spi.time.Timestamp ts)
    {
        Timestamp sqlTimestamp = new Timestamp(ts.getEpochSecond() * 1000);
        sqlTimestamp.setNanos(ts.getNano());
        return sqlTimestamp;
    }
}

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
embulk-input-mysql-0.8.6 src/main/java/org/embulk/input/mysql/getter/MySQLTimestampTimestampIncrementalHandler.java
embulk-input-mysql-0.8.5 src/main/java/org/embulk/input/mysql/getter/MySQLTimestampTimestampIncrementalHandler.java
embulk-input-mysql-0.8.4 src/main/java/org/embulk/input/mysql/getter/MySQLTimestampTimestampIncrementalHandler.java
embulk-input-mysql-0.8.3 src/main/java/org/embulk/input/mysql/getter/MySQLTimestampTimestampIncrementalHandler.java
embulk-input-mysql-0.8.2 src/main/java/org/embulk/input/mysql/getter/MySQLTimestampTimestampIncrementalHandler.java
embulk-input-mysql-0.8.1 src/main/java/org/embulk/input/mysql/getter/MySQLTimestampTimestampIncrementalHandler.java