Column tmplate, boolean compat, Column given, Table table,
boolean adapt, boolean fill) {
assertTable(context, table);
// if not adapting must provide column name at a minimum
DBIdentifier colName = (given == null) ? DBIdentifier.NULL : given.getIdentifier();
if (DBIdentifier.isNull(colName) && !adapt && !fill)
throw new MetaDataException(_loc.get(prefix + "-no-col-name",
context));
MappingRepository repos = (MappingRepository) context.getRepository();
DBDictionary dict = repos.getDBDictionary();
// determine the column name based on given info, or template if none;
// also make sure that if the user gave a column name, he didn't try
// to put the column in an unexpected table
if (DBIdentifier.isNull(colName))
colName = tmplate.getIdentifier();
QualifiedDBIdentifier path = QualifiedDBIdentifier.getPath(colName);
if (path.isUnqualifiedColumn()) {
colName = path.getIdentifier();
} else if (!DBIdentifier.isNull(path.getObjectTableName())) {
findTable(context, path.getObjectTableName(), table,
null, null);
colName = path.getUnqualifiedName();
}
// find existing column
Column col = table.getColumn(colName);
if (col == null && !adapt) {
//
// See if column name has already been validated in a dynamic table.
// If so then want to use that validated column name instead. This
// should seldom if ever occur as long as the database dictionaries
// are kept up-to-date.
//
if ((colName.getName().length() > dict.maxColumnNameLength) ||
dict.getInvalidColumnWordSet().contains(DBIdentifier.toUpper(colName).getName()) &&
!(table.getClass().getName().contains("DynamicTable"))) {
colName=dict.getValidColumnName(colName, new Table());
col = table.getColumn(colName);
if (col == null && !adapt) {