Changeset: cc4dd0565659 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=cc4dd0565659 Modified Files: clients/ChangeLog.Aug2011 clients/mapiclient/mclient.c Branch: Aug2011 Log Message:
mclient: avoid "ghost" results in batch mode When processing files without interactive mode (-i or as implied by -e) "ghost" results could be printed at certain points in the query output. The "ghost" result was in fact the last result from a block of data read by mclient, that was repeated without any data results for the next block of data read. This is caused by calling mapi_needmore followed by mapi_next_result, which is essential to move the current result pointer on to the next in line. Since mapi_next_result returns what mapi_needmore returns, but also advances the result pointer, mapi_needmore is simply not necessary, and due to the logic, causes the previous result to be printed again in the format_result loop. diffs (25 lines): diff --git a/clients/ChangeLog.Aug2011 b/clients/ChangeLog.Aug2011 --- a/clients/ChangeLog.Aug2011 +++ b/clients/ChangeLog.Aug2011 @@ -1,3 +1,7 @@ # ChangeLog file for clients # This file is updated with Maddlog +* Tue Sep 27 2011 Fabian Groffen <fab...@cwi.nl> +- Fixed a bug in mclient where processing queries from files could result + in ghost empty results to be reported in the output + diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c --- a/clients/mapiclient/mclient.c +++ b/clients/mapiclient/mclient.c @@ -1501,9 +1501,7 @@ format_result(Mapi mid, MapiHdl hdl, cha break; } } - } while (!mnstr_errnr(toConsole) && - (rc = mapi_needmore(hdl)) == MOK && - (rc = mapi_next_result(hdl)) == 1); + } while (!mnstr_errnr(toConsole) && (rc = mapi_next_result(hdl)) == 1); if (mnstr_errnr(toConsole)) { mnstr_clearerr(toConsole); fprintf(stderr, "write error\n"); _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list