pike.git / lib / modules / Sql.pmod / pgsql_util.pmod

version» Context lines:

pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:631:    final mixed delayederror;    final int(0..7) _state; // FIXME actually: int(PORTALINIT..PURGED)    final int _fetchlimit;    private int(0..1) alltext;    final int(0..1) _forcetext;    private int syncparse;    private int transtype;       final string _portalname;    -  private int rowsreceived; +     private int inflight;    int portalbuffersize;    private Thread.Mutex closemux;    private Thread.Queue datarows;    private Thread.ResourceCountKey stmtifkey, portalsifkey;    private array(mapping(string:mixed)) datarowdesc;    final array(int) datarowtypes; // types from datarowdesc    private string statuscmdcomplete;    private int bytesreceived;    final int _synctransact;
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:663:    string res;    switch (type) {    case 'O':    int fd = -1;    if (c && c->socket)    catch(fd = c->socket->query_fd());    res = sprintf("Result state: %d numrows: %d eof: %d inflight: %d\n"    "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    || (_unnamedstatementkey ? "*parsing*" : ""));    break;    }    return res;    }       protected void create(proxy _pgsqlsess, conxion _c, string query,
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:752:    //! @note    //! This method returns the number of rows already received from    //! the database for the current query. Note that this number    //! can still increase between subsequent calls if the results from    //! the query are not complete yet. This function is only guaranteed to    //! return the correct count after EOF has been reached.    //! @seealso    //! @[Sql.Result()->num_rows()]    /*semi*/final int num_rows() {    trydelayederror(); -  return rowsreceived; +  return index;    }       private void losterror() {    string err;    if (pgsqlsess)    err = pgsqlsess->geterror(1);    error("%s\n", err || LOSTERROR);    }       private void trydelayederror() {
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:1181:    }    lock = 0;    return retval;    }       final void _processdataready(array datarow, void|int msglen) {    bytesreceived += msglen;    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)    _sendexecute(_fetchlimit);    else if (!_fetchlimit)    PD("<%O _fetchlimit %d, inflight %d, skip execute\n",    _portalname, _fetchlimit, inflight);    lock = 0;    }    }