Changeset: 34976c59d153 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=34976c59d153
Modified Files:
        clients/mapilib/mapi.c
Branch: protocol
Log Message:

Immediately consume the server flush after the final read.


diffs (36 lines):

diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -5554,14 +5554,6 @@ mapi_fetch_row(MapiHdl hdl)
 
                // check if we have read the entire result set
                if (result->rows_read >= result->row_count) {
-                       char dummy;
-                       if (result->row_count != 0) {
-                               // this flush only occurs after a chunk has 
been sent
-                               // if the result set has 0 rows, this flush 
does not occur
-                               // hence we don't need to consume it
-                               mnstr_readChr(hdl->mid->from, &dummy);
-                       }
-                       bs2_resetbuf(hdl->mid->from);
                        do {
                                if ((reply = mapi_fetch_line(hdl)) == NULL)
                                        return 0;
@@ -5621,6 +5613,17 @@ mapi_fetch_row(MapiHdl hdl)
                                }
                        }
                        result->tuple_count += nrows;
+                       // check if we have read the entire result set
+                       if (result->tuple_count >= result->row_count) {
+                               char dummy;
+                               if (result->row_count != 0) {
+                                       // this flush only occurs after a chunk 
has been sent
+                                       // if the result set has 0 rows, this 
flush does not occur
+                                       // hence we don't need to consume it
+                                       mnstr_readChr(hdl->mid->from, &dummy);
+                               }
+                               bs2_resetbuf(hdl->mid->from);
+                       }
                } else {
                        for (i = 0; i < (size_t) result->fieldcnt; i++) {
                                if (result->fields[i].typelen < 0) {
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to