提交 9cbd604d authored 作者: Thomas Mueller's avatar Thomas Mueller

boolean getX > isX

上级 32aef28f
......@@ -3393,7 +3393,7 @@ public class Parser {
int type = dataType.type;
Column column = new Column(columnName, type, precision, scale, displaySize);
if (templateColumn != null) {
column.setNullable(templateColumn.getNullable());
column.setNullable(templateColumn.isNullable());
column.setDefaultExpression(session, templateColumn.getDefaultExpression());
int selectivity = templateColumn.getSelectivity();
if (selectivity != Constants.SELECTIVITY_DEFAULT) {
......@@ -3774,8 +3774,7 @@ public class Parser {
columns.add(new Column(c, Value.STRING));
}
int id = database.allocateObjectId(true, true);
recursiveTable = schema.createTable(tempViewName, id, columns, false, true, false, Index.EMPTY_HEAD, session);
recursiveTable.setTemporary(true);
recursiveTable = schema.createTable(tempViewName, id, columns, true, false, true, false, Index.EMPTY_HEAD, session);
session.addLocalTempTable(recursiveTable);
String querySQL = StringCache.getNew(sqlCommand.substring(parseIndex));
read("AS");
......@@ -4616,7 +4615,7 @@ public class Parser {
} else {
String columnName = readColumnIdentifier();
Column column = parseColumnForTable(columnName);
if (column.getAutoIncrement() && column.getPrimaryKey()) {
if (column.isAutoIncrement() && column.isPrimaryKey()) {
column.setPrimaryKey(false);
IndexColumn[] cols = new IndexColumn[]{new IndexColumn()};
cols[0].columnName = column.getName();
......
......@@ -249,7 +249,7 @@ public class AlterTableAddConstraint extends SchemaCommand {
}
// parent relationship is already set with addConstraint
constraint.setComment(comment);
if (table.getTemporary() && !table.getGlobalTemporary()) {
if (table.isTemporary() && !table.isGlobalTemporary()) {
session.addLocalTempTableConstraint(constraint);
} else {
db.addSchemaObject(session, constraint);
......@@ -305,7 +305,7 @@ public class AlterTableAddConstraint extends SchemaCommand {
}
private boolean canUseUniqueIndex(Index idx, Table table, IndexColumn[] cols) {
if (idx.getTable() != table || !idx.getIndexType().getUnique()) {
if (idx.getTable() != table || !idx.getIndexType().isUnique()) {
return false;
}
Column[] indexCols = idx.getColumns();
......
......@@ -113,7 +113,7 @@ public class AlterTableAlterColumn extends SchemaCommand {
Sequence sequence = oldColumn == null ? null : oldColumn.getSequence();
switch (type) {
case NOT_NULL: {
if (!oldColumn.getNullable()) {
if (!oldColumn.isNullable()) {
// no change
break;
}
......@@ -123,7 +123,7 @@ public class AlterTableAlterColumn extends SchemaCommand {
break;
}
case NULL: {
if (oldColumn.getNullable()) {
if (oldColumn.isNullable()) {
// no change
break;
}
......@@ -147,9 +147,9 @@ public class AlterTableAlterColumn extends SchemaCommand {
oldColumn.setSequence(null);
oldColumn.setDefaultExpression(session, null);
oldColumn.setConvertNullToDefault(false);
if (oldColumn.getNullable() && !newColumn.getNullable()) {
if (oldColumn.isNullable() && !newColumn.isNullable()) {
checkNoNullValues();
} else if (!oldColumn.getNullable() && newColumn.getNullable()) {
} else if (!oldColumn.isNullable() && newColumn.isNullable()) {
checkNullable();
}
convertToIdentityIfRequired(newColumn);
......@@ -185,7 +185,7 @@ public class AlterTableAlterColumn extends SchemaCommand {
}
private void convertToIdentityIfRequired(Column c) {
if (c.getAutoIncrement()) {
if (c.isAutoIncrement()) {
c.setOriginalSQL("IDENTITY");
}
}
......@@ -232,13 +232,14 @@ public class AlterTableAlterColumn extends SchemaCommand {
newColumns.remove(position);
newColumns.add(position, newColumn);
}
// create a table object in order to get the SQL statement
// can't just use this table, because most column objects are 'shared'
// with the old table
// still need a new id because using 0 would mean: the new table tries
// to use the rows of the table 0 (the meta table)
int id = db.allocateObjectId(true, true);
TableData newTable = getSchema().createTable(tempName, id, newColumns, table.isPersistIndexes(), table.isPersistData(), false, Index.EMPTY_HEAD, session);
TableData newTable = getSchema().createTable(tempName, id, newColumns, table.isTemporary(), table.isPersistIndexes(), table.isPersistData(), false, Index.EMPTY_HEAD, session);
newTable.setComment(table.getComment());
StringBuilder buff = new StringBuilder();
buff.append(newTable.getCreateSQL());
......@@ -263,8 +264,12 @@ public class AlterTableAlterColumn extends SchemaCommand {
}
buff.append(" FROM ").append(table.getSQL());
String newTableSQL = buff.toString();
String newTableName = newTable.getName();
Schema newTableSchema = newTable.getSchema();
newTable.removeChildrenAndResources(session);
execute(newTableSQL, true);
newTable = (TableData) newTable.getSchema().getTableOrView(session, newTable.getName());
newTable = (TableData) newTableSchema.getTableOrView(session, newTableName);
ObjectArray<String> triggers = ObjectArray.newInstance();
for (DbObject child : table.getChildren()) {
if (child instanceof Sequence) {
......@@ -384,7 +389,7 @@ public class AlterTableAlterColumn extends SchemaCommand {
continue;
}
IndexType indexType = index.getIndexType();
if (indexType.getPrimaryKey() || indexType.getHash()) {
if (indexType.isPrimaryKey() || indexType.isHash()) {
throw Message.getSQLException(ErrorCode.COLUMN_IS_PART_OF_INDEX_1, index.getSQL());
}
}
......
......@@ -44,7 +44,7 @@ public class AlterTableRename extends SchemaCommand {
throw Message.getSQLException(ErrorCode.TABLE_OR_VIEW_ALREADY_EXISTS_1, newTableName);
}
session.getUser().checkRight(oldTable, Right.ALL);
if (oldTable.getTemporary()) {
if (oldTable.isTemporary()) {
throw Message.getUnsupportedException("TEMP TABLE");
}
db.renameSchemaObject(session, oldTable, newTableName);
......
......@@ -131,7 +131,7 @@ public class CreateTable extends SchemaCommand {
}
ObjectArray<Sequence> sequences = ObjectArray.newInstance();
for (Column c : columns) {
if (c.getAutoIncrement()) {
if (c.isAutoIncrement()) {
int objId = getObjectId(true, true);
c.convertAutoIncrementToSequence(session, getSchema(), objId, temporary);
}
......@@ -141,9 +141,8 @@ public class CreateTable extends SchemaCommand {
}
}
int id = getObjectId(true, true);
TableData table = getSchema().createTable(tableName, id, columns, persistIndexes, persistData, clustered, headPos, session);
TableData table = getSchema().createTable(tableName, id, columns, temporary, persistIndexes, persistData, clustered, headPos, session);
table.setComment(comment);
table.setTemporary(temporary);
table.setGlobalTemporary(globalTemporary);
if (temporary && !globalTemporary) {
if (onCommitDrop) {
......@@ -167,7 +166,7 @@ public class CreateTable extends SchemaCommand {
command.update();
}
if (asQuery != null) {
boolean old = session.getUndoLogEnabled();
boolean old = session.isUndoLogEnabled();
try {
session.setUndoLogEnabled(false);
Insert insert = null;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论