Added create unique index for uuid column.

This commit is contained in:
Heng Sin Low 2010-12-28 12:48:08 +08:00
parent 7470545d87
commit f52598018c
1 changed files with 13 additions and 2 deletions

View File

@ -234,6 +234,19 @@ public class UUIDGenerator extends SvrProcess {
}
}
if (no != -1)
{
String indexName = column.getColumnName()+"_idx";
if (indexName.length() > 30) {
int i = indexName.length() - 31;
indexName = column.getColumnName().substring(0, column.getColumnName().length() - i);
indexName = indexName + "_uu_idx";
}
String indexSql = "CREATE UNIQUE INDEX " + indexName + " ON " + tableName
+ "(" + column.getColumnName() +")";
DB.executeUpdateEx(indexSql, null);
}
if (no == -1)
{
String msg = "@Error@ ";
@ -243,8 +256,6 @@ public class UUIDGenerator extends SvrProcess {
msg += sql;
throw new AdempiereUserError (msg);
}
//TODO: create unique index
} catch (SQLException e) {
throw new DBException(e);
} finally {