Unverified 提交 717ee982 authored 作者: Noel Grandin's avatar Noel Grandin 提交者: GitHub

Merge pull request #799 from katzyn/misc

Use result of ArrayList.remove()
......@@ -1554,15 +1554,13 @@ public class Parser {
} while (readIf("."));
schemaName = session.getCurrentSchemaName();
if (list.size() == 4) {
if (!equalsToken(database.getShortName(), list.get(0))) {
if (!equalsToken(database.getShortName(), list.remove(0))) {
throw DbException.getSyntaxError(sqlCommand, parseIndex,
"database name");
}
list.remove(0);
}
if (list.size() == 3) {
schemaName = list.get(0);
list.remove(0);
schemaName = list.remove(0);
}
if (list.size() != 2) {
throw DbException.getSyntaxError(sqlCommand, parseIndex,
......
......@@ -343,8 +343,7 @@ public class AlterTableAlterColumn extends SchemaCommand {
}
} else if (type == CommandInterface.ALTER_TABLE_ALTER_COLUMN_CHANGE_TYPE) {
int position = oldColumn.getColumnId();
newColumns.remove(position);
newColumns.add(position, newColumn);
newColumns.set(position, newColumn);
}
// create a table object in order to get the SQL statement
......
......@@ -79,8 +79,7 @@ public class UndoLog {
if (largeTransactions) {
if (i < 0 && storedEntries > 0) {
int last = storedEntriesPos.size() - 1;
long pos = storedEntriesPos.get(last);
storedEntriesPos.remove(last);
long pos = storedEntriesPos.remove(last);
long end = file.length();
int bufferLength = (int) (end - pos);
Data buff = Data.create(database, bufferLength);
......
......@@ -532,18 +532,15 @@ public abstract class Table extends SchemaObjectBase {
database.removeSchemaObject(session, view);
}
while (synonyms != null && synonyms.size() > 0) {
TableSynonym synonym = synonyms.get(0);
synonyms.remove(0);
TableSynonym synonym = synonyms.remove(0);
database.removeSchemaObject(session, synonym);
}
while (triggers != null && triggers.size() > 0) {
TriggerObject trigger = triggers.get(0);
triggers.remove(0);
TriggerObject trigger = triggers.remove(0);
database.removeSchemaObject(session, trigger);
}
while (constraints != null && constraints.size() > 0) {
Constraint constraint = constraints.get(0);
constraints.remove(0);
Constraint constraint = constraints.remove(0);
database.removeSchemaObject(session, constraint);
}
for (Right right : database.getAllRights()) {
......@@ -555,8 +552,7 @@ public abstract class Table extends SchemaObjectBase {
// must delete sequences later (in case there is a power failure
// before removing the table object)
while (sequences != null && sequences.size() > 0) {
Sequence sequence = sequences.get(0);
sequences.remove(0);
Sequence sequence = sequences.remove(0);
// only remove if no other table depends on this sequence
// this is possible when calling ALTER TABLE ALTER COLUMN
if (database.getDependentTable(sequence, this) == null) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论