comparison src/main/java/org/monetdb/jdbc/MonetConnection.java @ 701:f89882b07614 mclreader

Fix a problem with PREPARE INSERT And other prepared statements that have no result set and no parameters.
author Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
date Thu, 08 Dec 2022 16:59:44 +0100 (2022-12-08)
parents 940e266eeccd
children b4e968e5bd74
comparison
equal deleted inserted replaced
700:940e266eeccd 701:f89882b07614
2465 * This method returns true if not all headers are set, or the 2465 * This method returns true if not all headers are set, or the
2466 * first DataBlockResponse reports to want more. 2466 * first DataBlockResponse reports to want more.
2467 */ 2467 */
2468 @Override 2468 @Override
2469 public boolean wantsMore() { 2469 public boolean wantsMore() {
2470 if (isSet[LENS] && isSet[TYPES] && isSet[TABLES] && isSet[NAMES] && isSet[TYPESIZES]) { 2470 return resultBlocks[0].wantsMore();
2471 return resultBlocks[0].wantsMore();
2472 }
2473 return true;
2474 } 2471 }
2475 2472
2476 /** 2473 /**
2477 * Returns an array of Strings containing the values between 2474 * Returns an array of Strings containing the values between
2478 * ',\t' separators. 2475 * ',\t' separators.
3239 if (error != null) { 3236 if (error != null) {
3240 in.discardRemainder(); 3237 in.discardRemainder();
3241 break; 3238 break;
3242 } 3239 }
3243 3240
3244 // here we have a res object, which we can start filling 3241 // advance to the line after the header
3245 while (res.wantsMore()) { 3242 in.advance();
3243
3244 // stuff all header lines into the res
3245 while (error == null && in.getLineType() == LineType.HEADER) {
3246 error = res.addLine(in.getLine(), in.getLineType());
3246 in.advance(); 3247 in.advance();
3248 }
3249
3250 // then feed it more lines until it is satisfied
3251 while (error == null && res.wantsMore()) {
3247 error = res.addLine(in.getLine(), in.getLineType()); 3252 error = res.addLine(in.getLine(), in.getLineType());
3248 if (error != null) { 3253 in.advance();
3249 // right, some protocol violation,
3250 // skip the rest of the result
3251 error = "M0M10!" + error;
3252 in.discardRemainder();
3253 break;
3254 }
3255 } 3254 }
3256 if (error != null) 3255
3256 if (error != null) {
3257 // right, some protocol violation,
3258 // skip the rest of the result
3259 error = "M0M10!" + error;
3260 in.discardRemainder();
3257 break; 3261 break;
3262 }
3258 3263
3259 // it is of no use to store DataBlockResponses, you never want to 3264 // it is of no use to store DataBlockResponses, you never want to
3260 // retrieve them directly anyway 3265 // retrieve them directly anyway
3261 if (!(res instanceof DataBlockResponse)) 3266 if (!(res instanceof DataBlockResponse))
3262 responses.add(res); 3267 responses.add(res);
3263 3268
3264 // read the next line (can be prompt, new result, error, etc.) 3269 // We have already advanced 'in' to the next line in the response
3265 // before we start the loop over 3270 // so we're ready to start the next iteration of the loop.
3266 in.advance();
3267 break; 3271 break;
3268 case INFO: 3272 case INFO:
3269 addWarning(in.getLine().substring(1), "01000"); 3273 addWarning(in.getLine().substring(1), "01000");
3270 // read the next line (can be prompt, new result, error, etc.) 3274 // read the next line (can be prompt, new result, error, etc.)
3271 // before we start the loop over 3275 // before we start the loop over