Reuse previously written memo/ole values when updating other values in
a row in order to reduce unnecessary data duplication.
</action>
+ <action dev="jahlborn" type="update">
+ Allow ImportFilter and ExportFilter to return null from filterRow() to
+ indicate that a row should be skipped.
+ </action>
</release>
<release version="1.2.5" date="2011-10-19">
<action dev="jahlborn" type="update">
* @param row
* the row data as determined by the import code, may be directly
* modified
- * @return the row data as it should be written to the import table
+ * @return the row data as it should be written to the import table. if
+ * {@code null}, the row will be skipped
*/
public Object[] filterRow(Object[] row) throws IOException;
// apply filter
Object[] rowData = filter.filterRow(unfilteredRowData);
+ if(rowData == null) {
+ continue;
+ }
// print row
for (int i = 0; i < columns.size(); i++) {
* The desired values for the row.
* @param row the row data as determined by the import code, may be directly
* modified
- * @return the row data as it should be written to the import table
+ * @return the row data as it should be written to the import table. if
+ * {@code null}, the row will be skipped
*/
public Object[] filterRow(Object[] row)
throws SQLException, IOException;
for (int i = 0; i < row.length; i++) {
row[i] = source.getObject(i + 1);
}
- rows.add(filter.filterRow(row));
+ row = filter.filterRow(row);
+ if(row == null) {
+ continue;
+ }
+ rows.add(row);
if (rows.size() == COPY_TABLE_BATCH_SIZE) {
table.addRows(rows);
rows.clear();
while ((line = in.readLine()) != null)
{
Object[] data = splitLine(line, delimPat, quote, in, numColumns);
- rows.add(filter.filterRow(data));
+ data = filter.filterRow(data);
+ if(data == null) {
+ continue;
+ }
+ rows.add(data);
if (rows.size() == COPY_TABLE_BATCH_SIZE) {
table.addRows(rows);
rows.clear();