private void setFieldToNull ( boolean postgresText , String [ ] transformedStrings , int fieldIndex , Field field ) { if ( postgresText ) transformedStrings [ fieldIndex + 1 ] = POSTGRES_NULL_TEXT ; // Adjust parameter index by two: indexes are one-based and the first one is the CSV line number. else try { // LOG.info("setting {} index to null", fieldIndex + 2); field . setNull ( insertStatement , fieldIndex + 2 ) ; } catch ( SQLException e ) { e . printStackTrace ( ) ; // FIXME: store error here? It appears that an exception should only be thrown if the type value is invalid, // the connection is closed, or the index is out of bounds. So storing an error may be unnecessary. } }
Sets field to null in statement or string array depending on whether postgres is being used .