public void end(Table table) { String quote = getPlatform().getDatabaseInfo().getDelimiterToken(); this.transaction.allowInsertIntoAutoIncrementColumns(false, this.targetTable, quote); }
protected boolean filterBefore(CsvData data) { boolean process = true; List<IDatabaseWriterFilter> filters = this.writerSettings.getDatabaseWriterFilters(); if (filters != null) { try { statistics.get(batch).startTimer(DataWriterStatisticConstants.FILTERMILLIS); for (IDatabaseWriterFilter filter : filters) { process &= filter.beforeWrite(this.context, this.sourceTable, data); } // re-lookup target table in case the source table has changed Table oldTargetTable = targetTable; if (this.sourceTable!=null) { targetTable = lookupTableAtTarget(this.sourceTable); } if (targetTable!=null && !targetTable.equals(oldTargetTable)) { // allow for auto increment columns to be inserted into if appropriate String quote = getPlatform().getDatabaseInfo().getDelimiterToken(); if (oldTargetTable!=null) { transaction.allowInsertIntoAutoIncrementColumns(false, oldTargetTable, quote); } transaction.allowInsertIntoAutoIncrementColumns(true, targetTable, quote); } } finally { statistics.get(batch).stopTimer(DataWriterStatisticConstants.FILTERMILLIS); } } return process; }
public boolean start(Table table) { if (table == null) { throw new NullPointerException("Cannot load a null table"); } this.lastData = null; this.currentDmlStatement = null; this.sourceTable = table; this.targetTable = lookupTableAtTarget(this.sourceTable); this.sourceTable.copyColumnTypesFrom(this.targetTable); if (this.targetTable==null && hasFilterThatHandlesMissingTable(table)) { this.targetTable = table; } if (this.targetTable != null) { String quote = getPlatform().getDatabaseInfo().getDelimiterToken(); this.transaction.allowInsertIntoAutoIncrementColumns(true, this.targetTable, quote); return true; } else if (writerSettings.isIgnoreMissingTables()) { String qualifiedName = sourceTable.getFullyQualifiedTableName(); if (!missingTables.contains(qualifiedName)) { log.warn("Did not find the {} table in the target database", qualifiedName); missingTables.add(qualifiedName); } return false; } else { // The first data should fail because the table will not be found return true; } }
newlyTransformedData.getTableName()); writer.getTransaction().allowInsertIntoAutoIncrementColumns(false, table, quote); } else if (table.hasAutoIncrementColumn()) { writer.getTransaction().allowInsertIntoAutoIncrementColumns(true, table, quote);