@Initialize public void init() throws IllegalArgumentException { _errorRowCount = new AtomicInteger(); _updatedRowCount = new AtomicInteger(); if (errorHandlingOption == ErrorHandlingOption.SAVE_TO_FILE) { _errorDataContext = createErrorDataContext(); } final int bufferSize = bufferSizeOption.calculateBufferSize(0); //TODO what buffer size? needed? logger.info("Row buffer size set to {}", bufferSize); _writeBuffer = new WriteBuffer(bufferSize, this); try (UpdateableDatastoreConnection con = datastore.openConnection()) { final SchemaNavigator schemaNavigator = con.getSchemaNavigator(); final List<String> columnsNotFound = new ArrayList<>(); _targetConditionColumns = schemaNavigator.convertToColumns(schemaName, tableName, conditionColumnNames); for (int i = 0; i < _targetConditionColumns.length; i++) { if (_targetConditionColumns[i] == null) { columnsNotFound.add(conditionColumnNames[i]); } } if (!columnsNotFound.isEmpty()) { throw new IllegalArgumentException("Could not find column(s): " + columnsNotFound); } } }
logger.info("Row buffer size set to {}", bufferSize); _writeBuffer = new WriteBuffer(bufferSize, this);
logger.info("Row buffer size set to {}", bufferSize); _writeBuffer = new WriteBuffer(bufferSize, this);
_writeBuffer = new WriteBuffer(_bufferSize, rows -> { for (final Object[] objects : rows) { final String string = (String) objects[0];
public ExcelDataContextWriter(final File file, final String sheetName) { _dataContext = new ExcelDataContext(file); _sheetName = sheetName; _buffer = new WriteBuffer(2000, records -> _dataContext.executeUpdate(callback -> { final Table table = callback.getDataContext().getDefaultSchema().getTableByName(_sheetName); for (final Object[] objects : records) { final RowInsertionBuilder insert = callback.insertInto(table); for (int i = 0; i < objects.length; i++) { insert.value(i, objects[i]); } insert.execute(); } })); }