comparison src/main/java/org/monetdb/jdbc/MonetConnection.java @ 506:2ae90050720c onclient

Improve flushing around error responses Still doesn't work correctly but it looks better
author Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
date Thu, 19 Aug 2021 11:45:16 +0200 (2021-08-19)
parents 8a014286dac2
children 13b48891ac54
comparison
equal deleted inserted replaced
505:8a014286dac2 506:2ae90050720c
3147 String transferCommand = in.readLine(); 3147 String transferCommand = in.readLine();
3148 // Consume the fake prompt inserted by MapiSocket. 3148 // Consume the fake prompt inserted by MapiSocket.
3149 String dummy = in.readLine(); 3149 String dummy = in.readLine();
3150 // Handle the request 3150 // Handle the request
3151 error = handleTransfer(transferCommand); 3151 error = handleTransfer(transferCommand);
3152 // Then prepare for the next iteration
3152 if (error != null) { 3153 if (error != null) {
3153 out.writeLine("!HY000!" + error + "\n"); 3154 out.writeLine("!HY000!" + error + "\n");
3155 out.flush();
3156 error = in.waitForPrompt();
3157 } else {
3158 tmpLine = in.readLine();
3154 } 3159 }
3155 // Then prepare for the next iteration
3156 tmpLine = in.readLine();
3157 linetype = in.getLineType(); 3160 linetype = in.getLineType();
3158 break; 3161 break;
3159 default: // Yeah... in Java this is correct! 3162 default: // Yeah... in Java this is correct!
3160 // we have something we don't expect/understand, let's make it an error message 3163 // we have something we don't expect/understand, let's make it an error message
3161 tmpLine = String.format("!M0M10!protocol violation, unexpected %s line: %s", linetype, tmpLine); 3164 tmpLine = String.format("!M0M10!protocol violation, unexpected %s line: %s", linetype, tmpLine);