return;
}
String sTable = table.getFullName(getOwner(), "$", true);
Column column = index.getIndexColumn(0).getColumn();
Index primaryKey = table.getPrimaryKey();
boolean bColInPK = primaryKey.findIndexColumn(column) != null;
boolean bHaveMoreIndexes = false;
StringBuffer buf = new StringBuffer(128);
// determine if this is the first Full-Text index to be created (i.e. Full-Text table needed)
for (int i = 0, nCount = table.getIndexCount(); i < nCount && !bHaveMoreIndexes; ++i)
{
Index idx = table.getIndex(i);
bHaveMoreIndexes = idx != index && idx.getType() == Index.TEXT;
}
if (!bHaveMoreIndexes) // Need to create a new Full-Text table
{
createTextTable(table);
}
if (!bColInPK) // Existing Full-Text table to alter, column does not exist yet
{
buf.append("alter table ").append(sTable).append(" add column ");
appendColumnDeclaration(buf, column, false, false, ", "); // take only first column
m_appender.appendSQL(buf.toString()); // column nullable since rows can exist
buf.setLength(0);
dropTextTriggers(table);
createTextTriggers(table, null, null);
buf.append("update ").append(sTable).append(" dst inner join ");
buf.append(table.getFullName(getOwner(), null, true)).append(" src on ");
for (int i = 0, nCount = primaryKey.getIndexColumnCount(); i < nCount; ++i) // add PK cols
{
Column col = table.getColumn(i);
if (i != 0)
{
buf.append("and ");
}
buf.append("dst.").append(col.getQuotedName());
buf.append(" = src.").append(col.getQuotedName());
}
buf.append(" set dst.").append(column.getQuotedName());
buf.append(" = src.").append(column.getQuotedName());
m_appender.appendSQL(buf.toString()); // fill Full-Text column with data from source table