Skip to content

Commit 0e06eb2

Browse files
Parse & Sync and Close & Sync
1 parent 5c4b37f commit 0e06eb2

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/main/java/com/github/pgasync/netty/NettyPgProtocolStream.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ public CompletableFuture<Message> send(Message message) {
136136
return offerRoundTrip(() -> {
137137
lastSentMessage = message;
138138
write(message);
139+
if (message instanceof ExtendedQueryMessage) {
140+
write(FIndicators.SYNC);
141+
}
139142
});
140143
}
141144

@@ -154,8 +157,9 @@ public CompletableFuture<Integer> send(Bind bind, Describe describe, Consumer<Ro
154157
this.onRow = onRow;
155158
this.onAffected = null;
156159
return offerRoundTrip(() -> {
157-
lastSentMessage = new Execute();
158-
write(bind, describe, lastSentMessage, FIndicators.SYNC);
160+
Execute execute;
161+
lastSentMessage = execute = new Execute();
162+
write(bind, describe, execute, FIndicators.SYNC);
159163
}).thenApply(commandComplete -> ((CommandComplete) commandComplete).getAffectedRows());
160164
}
161165

@@ -165,8 +169,9 @@ public CompletableFuture<Integer> send(Bind bind, Consumer<DataRow> onRow) {
165169
this.onRow = onRow;
166170
this.onAffected = null;
167171
return offerRoundTrip(() -> {
168-
lastSentMessage = new Execute();
169-
write(bind, lastSentMessage, FIndicators.SYNC);
172+
Execute execute;
173+
lastSentMessage = execute = new Execute();
174+
write(bind, execute, FIndicators.SYNC);
170175
}).thenApply(commandComplete -> ((CommandComplete) commandComplete).getAffectedRows());
171176
}
172177

@@ -230,6 +235,8 @@ private void respondWithMessage(Message message) {
230235
Logger.getLogger(NettyPgProtocolStream.class.getName()).log(Level.WARNING, message.toString());
231236
} else if (message == BIndicators.BIND_COMPLETE) {
232237
// op op since bulk message sequence
238+
} else if (message == BIndicators.PARSE_COMPLETE || message == BIndicators.CLOSE_COMPLETE) {
239+
readyForQueryPendingMessage = message;
233240
} else if (message instanceof RowDescription) {
234241
onColumns.accept(((RowDescription) message).getColumns());
235242
} else if (message == BIndicators.NO_DATA) {

0 commit comments

Comments
 (0)