Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure proper prologue/epilogue for every statement in JDBC list #4047

Merged
merged 1 commit into from Apr 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 6 additions & 5 deletions h2/src/main/org/h2/command/CommandList.java
Expand Up @@ -20,7 +20,7 @@
*/
class CommandList extends Command {

private CommandContainer command;
private final CommandContainer command;
private final ArrayList<Prepared> commands;
private final ArrayList<Parameter> parameters;
private String remaining;
Expand All @@ -42,20 +42,21 @@ public ArrayList<? extends ParameterInterface> getParameters() {

private void executeRemaining() {
for (Prepared prepared : commands) {
CommandContainer commandContainer = new CommandContainer(session, prepared.getSQL(), prepared);
prepared.prepare();
if (prepared.isQuery()) {
prepared.query(0);
executeQuery(0, false);
} else {
prepared.update();
commandContainer.executeUpdate(null);
}
}
if (remaining != null) {
remainingCommand = session.prepareLocal(remaining);
remaining = null;
if (remainingCommand.isQuery()) {
remainingCommand.query(0);
remainingCommand.executeQuery(0, false);
} else {
remainingCommand.update(null);
remainingCommand.executeUpdate(null);
}
}
}
Expand Down