{
try {
activeMetaData.getColumnIndex(attributes.getQName(i));
}
catch (NoSuchColumnException e) {
columnsToMerge.add(new Column(attributes.getQName(i), DataType.UNKNOWN));
}
}
if (!columnsToMerge.isEmpty())
{
if (_columnSensing)
{
logger.debug("Column sensing enabled. Will create a new metaData with potentially new columns if needed");
activeMetaData = mergeTableMetaData(columnsToMerge, activeMetaData);
_orderedTableNameMap.update(activeMetaData.getTableName(), activeMetaData);
// We also need to recreate the table, copying the data already collected from the old one to the new one
_consumer.startTable(activeMetaData);
}
else
{
StringBuffer extraColumnNames = new StringBuffer();
for (Iterator i = columnsToMerge.iterator(); i.hasNext();) {
Column col = (Column) i.next();
extraColumnNames.append(extraColumnNames.length() > 0 ? "," : "").append(col.getColumnName());
}
String msg = "Extra columns (" + extraColumnNames.toString() + ") on line " + (_lineNumber + 1)
+ " for table " + activeMetaData.getTableName() + " (global line number is "
+ _lineNumberGlobal + "). Those columns will be ignored.";
msg += "\n\tPlease add the extra columns to line 1,"