Skip to content

Commit

Permalink
ensure proper prologue/epilogue for every statement in JDBC ";"-separ…
Browse files Browse the repository at this point in the history
…ated list
  • Loading branch information
andreitokar committed Apr 21, 2024
1 parent 0f29221 commit 925a188
Showing 1 changed file with 6 additions and 5 deletions.
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

0 comments on commit 925a188

Please sign in to comment.