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

Clear content of GeneratedKeys in getKeys() to free some memory

上级 e87eb442
...@@ -125,6 +125,7 @@ public final class GeneratedKeys { ...@@ -125,6 +125,7 @@ public final class GeneratedKeys {
public LocalResult getKeys(Session session) { public LocalResult getKeys(Session session) {
Database db = session == null ? null : session.getDatabase(); Database db = session == null ? null : session.getDatabase();
if (Boolean.FALSE.equals(generatedKeysRequest)) { if (Boolean.FALSE.equals(generatedKeysRequest)) {
clear(null);
return new LocalResult(); return new LocalResult();
} }
ArrayList<ExpressionColumn> expressionColumns; ArrayList<ExpressionColumn> expressionColumns;
...@@ -148,6 +149,7 @@ public final class GeneratedKeys { ...@@ -148,6 +149,7 @@ public final class GeneratedKeys {
} }
} }
} else { } else {
clear(null);
return new LocalResult(); return new LocalResult();
} }
} else if (generatedKeysRequest instanceof String[]) { } else if (generatedKeysRequest instanceof String[]) {
...@@ -177,13 +179,16 @@ public final class GeneratedKeys { ...@@ -177,13 +179,16 @@ public final class GeneratedKeys {
allColumns.add(column); allColumns.add(column);
} }
} else { } else {
clear(null);
return new LocalResult(); return new LocalResult();
} }
} else { } else {
clear(null);
return new LocalResult(); return new LocalResult();
} }
int columnCount = expressionColumns.size(); int columnCount = expressionColumns.size();
if (columnCount == 0) { if (columnCount == 0) {
clear(null);
return new LocalResult(); return new LocalResult();
} }
LocalResult result = new LocalResult(session, expressionColumns.toArray(new Expression[0]), columnCount); LocalResult result = new LocalResult(session, expressionColumns.toArray(new Expression[0]), columnCount);
...@@ -202,6 +207,7 @@ public final class GeneratedKeys { ...@@ -202,6 +207,7 @@ public final class GeneratedKeys {
} }
result.addRow(row); result.addRow(row);
} }
clear(null);
return result; return result;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论