Search in sources :

Example 1 with TimestampType

use of org.dbflute.s2dao.valuetype.basic.TimestampType in project dbflute-core by dbflute.

the class DfLReverseDataExtractor method createColumnValueTypeMap.

// ===================================================================================
// JDBC Handling
// =============
protected Map<String, ValueType> createColumnValueTypeMap(List<Column> columnList) {
    final Map<String, ValueType> valueTypeMap = new LinkedHashMap<String, ValueType>();
    for (Column column : columnList) {
        final String columnName = column.getName();
        // create value type for the column
        final ValueType valueType;
        if (column.isJavaNativeStringObject()) {
            if (column.isDbTypeStringClob()) {
                valueType = new StringClobType();
            } else {
                valueType = new StringType();
            }
        } else if (column.isJavaNativeDateObject()) {
            // date types should be treated correctly
            if (column.isJdbcTypeTime()) {
                valueType = new TimeType();
            } else if (column.isJdbcTypeTimestamp()) {
                valueType = new TimestampType();
            } else if (column.isJdbcTypeDate()) {
                if (column.isDbTypeOracleDate()) {
                    valueType = new UtilDateAsTimestampType();
                } else {
                    valueType = new UtilDateAsSqlDateType();
                }
            } else {
                // no way
                valueType = new TimestampType();
            }
        } else if (column.isJavaNativeBinaryObject()) {
            // unsupported BLOG as loda data
            valueType = new NullBytesType();
        } else {
            // other types are treated as string
            // because ReplaceSchema can accept them
            valueType = new StringType();
        }
        valueTypeMap.put(columnName, valueType);
    }
    return valueTypeMap;
}
Also used : UtilDateAsSqlDateType(org.dbflute.s2dao.valuetype.basic.UtilDateAsSqlDateType) ValueType(org.dbflute.jdbc.ValueType) Column(org.apache.torque.engine.database.model.Column) StringType(org.dbflute.s2dao.valuetype.basic.StringType) StringClobType(org.dbflute.s2dao.valuetype.plugin.StringClobType) TimestampType(org.dbflute.s2dao.valuetype.basic.TimestampType) UtilDateAsTimestampType(org.dbflute.s2dao.valuetype.basic.UtilDateAsTimestampType) UtilDateAsTimestampType(org.dbflute.s2dao.valuetype.basic.UtilDateAsTimestampType) LinkedHashMap(java.util.LinkedHashMap) TimeType(org.dbflute.s2dao.valuetype.basic.TimeType)

Example 2 with TimestampType

use of org.dbflute.s2dao.valuetype.basic.TimestampType in project dbflute-core by dbflute.

the class DfLReverseDataExtractor method createColumnValueTypeMap.

protected Map<String, ValueType> createColumnValueTypeMap(List<Column> columnList) {
    final Map<String, ValueType> valueTypeMap = new LinkedHashMap<String, ValueType>();
    for (Column column : columnList) {
        final String columnName = column.getName();
        // create value type for the column
        final ValueType valueType;
        if (column.isJavaNativeStringObject()) {
            if (column.isDbTypeStringClob()) {
                valueType = new StringClobType();
            } else {
                valueType = new StringType();
            }
        } else if (column.isJavaNativeDateObject()) {
            // date types should be treated correctly
            if (column.isJdbcTypeTime()) {
                valueType = new TimeType();
            } else if (column.isJdbcTypeTimestamp()) {
                valueType = new TimestampType();
            } else if (column.isJdbcTypeDate()) {
                if (column.isDbTypeOracleDate()) {
                    valueType = new UtilDateAsTimestampType();
                } else {
                    valueType = new UtilDateAsSqlDateType();
                }
            } else {
                // no way
                valueType = new TimestampType();
            }
        } else if (column.isJavaNativeBinaryObject()) {
            // unsupported BLOG as load data
            valueType = new NullBytesType();
        } else {
            // other types are treated as string
            // because ReplaceSchema can accept them
            valueType = new StringType();
        }
        valueTypeMap.put(columnName, valueType);
    }
    return valueTypeMap;
}
Also used : UtilDateAsSqlDateType(org.dbflute.s2dao.valuetype.basic.UtilDateAsSqlDateType) ValueType(org.dbflute.jdbc.ValueType) Column(org.apache.torque.engine.database.model.Column) StringType(org.dbflute.s2dao.valuetype.basic.StringType) StringClobType(org.dbflute.s2dao.valuetype.plugin.StringClobType) TimestampType(org.dbflute.s2dao.valuetype.basic.TimestampType) UtilDateAsTimestampType(org.dbflute.s2dao.valuetype.basic.UtilDateAsTimestampType) UtilDateAsTimestampType(org.dbflute.s2dao.valuetype.basic.UtilDateAsTimestampType) LinkedHashMap(java.util.LinkedHashMap) TimeType(org.dbflute.s2dao.valuetype.basic.TimeType)

Aggregations

LinkedHashMap (java.util.LinkedHashMap)2 Column (org.apache.torque.engine.database.model.Column)2 ValueType (org.dbflute.jdbc.ValueType)2 StringType (org.dbflute.s2dao.valuetype.basic.StringType)2 TimeType (org.dbflute.s2dao.valuetype.basic.TimeType)2 TimestampType (org.dbflute.s2dao.valuetype.basic.TimestampType)2 UtilDateAsSqlDateType (org.dbflute.s2dao.valuetype.basic.UtilDateAsSqlDateType)2 UtilDateAsTimestampType (org.dbflute.s2dao.valuetype.basic.UtilDateAsTimestampType)2 StringClobType (org.dbflute.s2dao.valuetype.plugin.StringClobType)2