diff --git a/lib/modules/Sql.pmod/pgsql_util.pmod b/lib/modules/Sql.pmod/pgsql_util.pmod index 73488a69b3d186f5835b11d1ca973f8e2abd2a45..1ed9983bbfecd0815b1d5f344c841d32afc20e84 100644 --- a/lib/modules/Sql.pmod/pgsql_util.pmod +++ b/lib/modules/Sql.pmod/pgsql_util.pmod @@ -635,7 +635,6 @@ class sql_result { final string _portalname; - private int rowsreceived; private int inflight; int portalbuffersize; private Thread.Mutex closemux; @@ -667,7 +666,7 @@ class sql_result { "query: %O\n" "fd: %O portalname: %O datarows: %d" " synctransact: %d laststatus: %s\n", - _state, rowsreceived, eoffound, inflight, + _state, index, eoffound, inflight, _query, fd, _portalname, datarowtypes && sizeof(datarowtypes), _synctransact, statuscmdcomplete @@ -762,7 +761,7 @@ class sql_result { //! @[Sql.sql_result()->num_rows()] /*semi*/final int num_rows() { trydelayederror(); - return rowsreceived; + return index; } private void losterror() { @@ -1191,13 +1190,13 @@ class sql_result { inflight--; if (_state<CLOSED) datarows->write(datarow); - if (++rowsreceived == 1) + if (++index == 1) PD("<%O _fetchlimit %d=min(%d||1,%d), inflight %d\n", _portalname, - _fetchlimit, (portalbuffersize >> 1) * rowsreceived / bytesreceived, + _fetchlimit, (portalbuffersize >> 1) * index / bytesreceived, pgsqlsess._fetchlimit, inflight); if (_fetchlimit) { _fetchlimit = - min((portalbuffersize >> 1) * rowsreceived / bytesreceived || 1, + min((portalbuffersize >> 1) * index / bytesreceived || 1, pgsqlsess._fetchlimit); Thread.MutexKey lock = closemux->lock(); if (_fetchlimit && inflight <= (_fetchlimit - 1) >> 1) diff --git a/lib/modules/Sql.pmod/sql_result.pike b/lib/modules/Sql.pmod/sql_result.pike index 6cde8c26a379b9de5ed303f3b443d883e3199262..1986a359b7a39e9f81c1aa2c1d4c1c97b84e3c5c 100644 --- a/lib/modules/Sql.pmod/sql_result.pike +++ b/lib/modules/Sql.pmod/sql_result.pike @@ -57,10 +57,8 @@ array(mapping(string:mixed)) fetch_fields(); void seek(int skip) { if(skip<0) error("Cannot seek to negative result indices\n"); - while(skip--) { - index++; + while(skip--) master_res->fetch_row(); - } } //! Fetch the next row from the result.