use of org.jkiss.dbeaver.ext.mysql.model.MySQLTableIndexColumn in project dbeaver by serge-rider.
the class MySQLIndexConfigurator method configureObject.
@Override
public MySQLTableIndex configureObject(DBRProgressMonitor monitor, Object parent, MySQLTableIndex index) {
return UITask.run(() -> {
MyEditIndexPage editPage = new MyEditIndexPage(index);
if (!editPage.edit()) {
return null;
}
StringBuilder idxName = new StringBuilder(64);
idxName.append(CommonUtils.escapeIdentifier(index.getParentObject().getName()));
int colIndex = 1;
for (DBSEntityAttribute tableColumn : editPage.getSelectedAttributes()) {
if (colIndex == 1) {
// $NON-NLS-1$
idxName.append("_").append(CommonUtils.escapeIdentifier(tableColumn.getName()));
}
Integer length = (Integer) editPage.getAttributeProperty(tableColumn, MyEditIndexPage.PROP_LENGTH);
index.addColumn(new MySQLTableIndexColumn(index, (MySQLTableColumn) tableColumn, colIndex++, !Boolean.TRUE.equals(editPage.getAttributeProperty(tableColumn, EditIndexPage.PROP_DESC)), false, length == null ? null : String.valueOf(length)));
}
// $NON-NLS-1$
idxName.append("_IDX");
index.setName(DBObjectNameCaseTransformer.transformObjectName(index, idxName.toString()));
index.setName(idxName.toString());
index.setIndexType(editPage.getIndexType());
index.setUnique(editPage.isUnique());
return index;
});
}
use of org.jkiss.dbeaver.ext.mysql.model.MySQLTableIndexColumn in project dbeaver by dbeaver.
the class MySQLIndexConfigurator method configureObject.
@Override
public MySQLTableIndex configureObject(DBRProgressMonitor monitor, Object parent, MySQLTableIndex index) {
return UITask.run(() -> {
MyEditIndexPage editPage = new MyEditIndexPage(index);
if (!editPage.edit()) {
return null;
}
StringBuilder idxName = new StringBuilder(64);
idxName.append(CommonUtils.escapeIdentifier(index.getParentObject().getName()));
int colIndex = 1;
for (DBSEntityAttribute tableColumn : editPage.getSelectedAttributes()) {
if (colIndex == 1) {
// $NON-NLS-1$
idxName.append("_").append(CommonUtils.escapeIdentifier(tableColumn.getName()));
}
Integer length = (Integer) editPage.getAttributeProperty(tableColumn, MyEditIndexPage.PROP_LENGTH);
index.addColumn(new MySQLTableIndexColumn(index, (MySQLTableColumn) tableColumn, colIndex++, !Boolean.TRUE.equals(editPage.getAttributeProperty(tableColumn, EditIndexPage.PROP_DESC)), false, length == null ? null : String.valueOf(length)));
}
// $NON-NLS-1$
idxName.append("_IDX");
index.setName(DBObjectNameCaseTransformer.transformObjectName(index, idxName.toString()));
index.setName(idxName.toString());
index.setIndexType(editPage.getIndexType());
index.setUnique(editPage.isUnique());
return index;
});
}
Aggregations