提交 a55e6e50 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Use result of ArrayList.remove()

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