# HG changeset patch
# User Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
# Date 1629366316 -7200
# Node ID 2ae90050720c6e422d45b4d8121b05704c882d6f
# Parent  8a014286dac2f77fafdf32aabb4cda47e6e396e6
Improve flushing around error responses

Still doesn't work correctly but it looks better

diff --git a/src/main/java/org/monetdb/jdbc/MonetConnection.java b/src/main/java/org/monetdb/jdbc/MonetConnection.java
--- a/src/main/java/org/monetdb/jdbc/MonetConnection.java
+++ b/src/main/java/org/monetdb/jdbc/MonetConnection.java
@@ -3149,11 +3149,14 @@ public class MonetConnection
 							String dummy = in.readLine();
 							// Handle the request
 							error = handleTransfer(transferCommand);
+							// Then prepare for the next iteration
 							if (error != null) {
 								out.writeLine("!HY000!" + error + "\n");
+								out.flush();
+								error = in.waitForPrompt();
+							} else {
+								tmpLine = in.readLine();
 							}
-							// Then prepare for the next iteration
-							tmpLine = in.readLine();
 							linetype = in.getLineType();
 							break;
 						default:	// Yeah... in Java this is correct!