* Fixed import of view.

This commit is contained in:
Heng Sin Low 2007-07-29 07:53:40 +00:00
parent a00119f209
commit 333d73e8fd
1 changed files with 21 additions and 19 deletions

View File

@ -238,21 +238,24 @@ public class ColumnElementHandler extends AbstractElementHandler {
} }
if (recreateColumn || syncDatabase) { if (recreateColumn || syncDatabase) {
success = createColumn(ctx, m_Column, recreateColumn); MTable table = new MTable(ctx, m_Column.getAD_Table_ID(), getTrxName(ctx));
if (!table.isView()) {
success = createColumn(ctx, table, m_Column, recreateColumn);
if (success == 1) { if (success == 1) {
record_log(ctx, 1, m_Column.getColumnName(), "dbColumn", record_log(ctx, 1, m_Column.getColumnName(), "dbColumn",
m_Column.get_ID(), 0, Object_Status, atts.getValue( m_Column.get_ID(), 0, Object_Status, atts.getValue(
"ADTableNameID").toUpperCase(), "ADTableNameID").toUpperCase(),
get_IDWithColumn(ctx, "AD_Table", "TableName", atts get_IDWithColumn(ctx, "AD_Table", "TableName", atts
.getValue("ADTableNameID").toUpperCase())); .getValue("ADTableNameID").toUpperCase()));
} else { } else {
record_log(ctx, 0, m_Column.getColumnName(), "dbColumn", record_log(ctx, 0, m_Column.getColumnName(), "dbColumn",
m_Column.get_ID(), 0, Object_Status, atts.getValue( m_Column.get_ID(), 0, Object_Status, atts.getValue(
"ADTableNameID").toUpperCase(), "ADTableNameID").toUpperCase(),
get_IDWithColumn(ctx, "AD_Table", "TableName", atts get_IDWithColumn(ctx, "AD_Table", "TableName", atts
.getValue("ADTableNameID").toUpperCase())); .getValue("ADTableNameID").toUpperCase()));
throw new DatabaseAccessException("Failed to create column or related constraint for " + m_Column.getColumnName()); throw new DatabaseAccessException("Failed to create column or related constraint for " + m_Column.getColumnName());
}
} }
} }
} else { } else {
@ -271,10 +274,7 @@ public class ColumnElementHandler extends AbstractElementHandler {
* @param v_IsMandatory * @param v_IsMandatory
* *
*/ */
private int createColumn(Properties ctx, MColumn column, boolean doAlter) { private int createColumn(Properties ctx, MTable table, MColumn column, boolean doAlter) {
MTable table = new MTable(ctx, column.getAD_Table_ID(), getTrxName(ctx));
if (table.isView())
return 0;
int no = 0; int no = 0;
@ -328,6 +328,8 @@ public class ColumnElementHandler extends AbstractElementHandler {
if (sql.indexOf(DB.SQLSTATEMENT_SEPARATOR) == -1) { if (sql.indexOf(DB.SQLSTATEMENT_SEPARATOR) == -1) {
no = DB.executeUpdate(sql, false, getTrxName(ctx)); no = DB.executeUpdate(sql, false, getTrxName(ctx));
if (no == -1)
return 0;
} else { } else {
String statements[] = sql.split(DB.SQLSTATEMENT_SEPARATOR); String statements[] = sql.split(DB.SQLSTATEMENT_SEPARATOR);
for (int i = 0; i < statements.length; i++) { for (int i = 0; i < statements.length; i++) {