Don't forget to update num_total_read field of QResultClass record in case 'fetch...
authorHiroshi Inoue <h-inoue@dream.email.ne.jp>
Sun, 20 Mar 2016 05:58:10 +0000 (14:58 +0900)
committerHiroshi Inoue <h-inoue@dream.email.ne.jp>
Sun, 20 Mar 2016 06:16:35 +0000 (15:16 +0900)
qresult.c

index a09b2da2df2be0d190b8c8e87559ff66c0e2d1aa..221073d0b5f41e3043e88becfc6bb80d34d18a63 100644 (file)
--- a/qresult.c
+++ b/qresult.c
@@ -669,15 +669,15 @@ inolog("!![%d].PGType %u->%u\n", i, PIC_get_pgtype(ipdopts->parameters[i]), CI_g
        return FALSE;
 
 inolog("!!%p->cursTup=%d total_read=%d\n", self, self->cursTuple, self->num_total_read);
+   if (!QR_once_reached_eof(self) && self->cursTuple >= (Int4) self->num_total_read)
+       self->num_total_read = self->cursTuple + 1;
    if (self->num_cached_rows < self->cache_size)
    {
        reached_eof_now = TRUE;
        QR_set_reached_eof(self);
    }
-   if (!QR_once_reached_eof(self) && self->cursTuple >= (Int4) self->num_total_read)
-       self->num_total_read = self->cursTuple + 1;
    if (reached_eof_now && self->cursTuple < (Int4) self->num_total_read)
-       self->cursTuple++;
+       self->cursTuple = self->num_total_read;
 
    if (NULL != conn)
    {