Search in sources :

Example 6 with DfDelimiterDataRegistrationFailureException

use of org.dbflute.exception.DfDelimiterDataRegistrationFailureException in project dbflute-core by dbflute.

the class DfDelimiterDataWriteSqlBuilder method createBasicColumnValueMap.

// ===================================================================================
// SQL Parts
// =========
protected Map<String, String> createBasicColumnValueMap() {
    if (_basicColumnValueMap != null) {
        return _basicColumnValueMap;
    }
    _basicColumnValueMap = new LinkedHashMap<String, String>();
    int columnCount = -1;
    for (String columnName : _columnNameList) {
        columnCount++;
        if (!_columnMetaMap.isEmpty() && !_columnMetaMap.containsKey(columnName)) {
            // changed logic at setupColumnNameList() in writer like this:
            // "added columns for default value are existing in DB"
            // by jflute (2017/03/26)
            // if (hasDefaultValue(columnName)) {
            // continue;
            // }
            handleNotFoundColumn(columnName);
            continue;
        }
        final String value;
        try {
            value = columnCount < _valueList.size() ? _valueList.get(columnCount) : null;
        } catch (RuntimeException e) {
            String msg = buildDelimiterDataRegistrationFailureMessage(columnCount);
            throw new DfDelimiterDataRegistrationFailureException(msg, e);
        }
        if (!_columnMetaMap.isEmpty() && _columnMetaMap.containsKey(columnName)) {
            String realDbName = _columnMetaMap.get(columnName).getColumnName();
            _basicColumnValueMap.put(realDbName, value);
        } else {
            _basicColumnValueMap.put(columnName, value);
        }
    }
    return _basicColumnValueMap;
}
Also used : DfDelimiterDataRegistrationFailureException(org.dbflute.exception.DfDelimiterDataRegistrationFailureException)

Aggregations

DfDelimiterDataRegistrationFailureException (org.dbflute.exception.DfDelimiterDataRegistrationFailureException)6 File (java.io.File)4 IOException (java.io.IOException)3 BufferedReader (java.io.BufferedReader)2 FileInputStream (java.io.FileInputStream)2 InputStreamReader (java.io.InputStreamReader)2 Connection (java.sql.Connection)2 PreparedStatement (java.sql.PreparedStatement)2 SQLException (java.sql.SQLException)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Map (java.util.Map)2 TreeSet (java.util.TreeSet)2 DfJDBCException (org.dbflute.exception.DfJDBCException)2 DfColumnMeta (org.dbflute.logic.jdbc.metadata.info.DfColumnMeta)2 FileNotFoundException (java.io.FileNotFoundException)1 FilenameFilter (java.io.FilenameFilter)1 Comparator (java.util.Comparator)1 DfDelimiterDataResultInfo (org.dbflute.logic.replaceschema.loaddata.DfDelimiterDataResultInfo)1 LoggingInsertType (org.dbflute.logic.replaceschema.loaddata.base.dataprop.DfLoadingControlProp.LoggingInsertType)1