Sha256: d67ff1cbf5b689c063a16d75c8358225bd3c103181c14cd60be0a75a7f7e9e76

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

package org.embulk.input.sqlserver.getter;

import org.embulk.input.jdbc.AbstractJdbcInputPlugin;
import org.embulk.input.jdbc.JdbcColumn;
import org.embulk.input.jdbc.JdbcColumnOption;
import org.embulk.input.jdbc.JdbcInputConnection;
import org.embulk.input.jdbc.getter.*;
import org.embulk.spi.PageBuilder;
import org.joda.time.DateTimeZone;

public class SQLServerColumnGetterFactory extends ColumnGetterFactory {

    public SQLServerColumnGetterFactory(PageBuilder to, DateTimeZone defaultTimeZone)
    {
        super(to, defaultTimeZone);
    }

    @Override
    public ColumnGetter newColumnGetter(JdbcInputConnection con, AbstractJdbcInputPlugin.PluginTask task, JdbcColumn column, JdbcColumnOption option)
    {
        switch (column.getTypeName()) {
        case "date":
        case "datetime2":
        case "time":
        case "sql_variant":
        // DateTimeOffset is available only in MSSQL
        case "datetimeoffset":
            // because jTDS driver, default JDBC driver for older embulk-input-sqlserver, returns Types.VARCHAR as JDBC type for these types.
            return new StringColumnGetter(to,  getToType(option));

        case "datetime":
            ColumnGetter getter = super.newColumnGetter(con, task, column, option);
            return new TimestampWithoutTimeZoneIncrementalHandler(getter);

        default:
            return super.newColumnGetter(con, task, column, option);
        }
    }

}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
embulk-input-sqlserver-0.10.1 src/main/java/org/embulk/input/sqlserver/getter/SQLServerColumnGetterFactory.java