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

version» Context lines:

pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:338:   };      class conxiin {    inherit Stdio.Buffer:i;       final Thread.Condition fillread;    final MUTEX fillreadmux;    final int procmsg;    private int didreadcb;    + #if PG_DEBUGHISTORY > 0 +  final array history = ({}); +  +  final int(-1..) input_from(Stdio.Stream stm, void|int(0..) nbytes) { +  int oldsize = sizeof(this); +  int ret = i::input_from(stm, nbytes); +  if (ret) { +  Stdio.Buffer tb = Stdio.Buffer(this); +  tb->consume(oldsize); +  history += ({"<<"+tb->read(ret)}); +  history = history[<PG_DEBUGHISTORY - 1 ..]; +  } +  return ret; +  } + #endif +     protected final bool range_error(int howmuch) {   #ifdef PG_DEBUG    if (howmuch < 0) {    int available = unread(0);    unread(available);    error("Out of range %d %O %O\n", howmuch,    ((string)this)[.. available-1], ((string)this)[available ..]);    }   #endif    if (fillread) {
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:419:    final Thread.ResourceCount stashcount;    final int synctransact;   #ifdef PG_DEBUGRACE    final mixed nostrack;   #endif   #ifdef PG_DEBUG    final int queueoutidx;    final int queueinidx = -1;   #endif    + #if PG_DEBUGHISTORY > 0 +  final int(-1..) output_to(Stdio.Stream stm, void|int(0..) nbytes) { +  Stdio.Buffer tb = Stdio.Buffer(this); +  int ret = o::output_to(stm, nbytes); +  if (ret) { +  i->history += ({">>" + tb->read(ret)}); +  i->history = i->history[<PG_DEBUGHISTORY - 1 ..]; +  } +  return ret; +  } + #endif +     private inline void queueup(sql_result portal) {    qportals->write(portal); portal->_synctransact = synctransact;    PD("%d>%O %d %d Queue portal %d bytes\n", socket->query_fd(),    portal._portalname, ++queueoutidx, synctransact, sizeof(this));    }       final bufcon|conxsess start(void|int waitforreal) {    Thread.MutexKey lock;   #ifdef PG_DEBUGRACE    if (nostash->current_locking_thread())
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:762:       protected string _sprintf(int type) {    string res;    switch (type) {    case 'O':    int fd = -1;    if (c && c->socket)    catch(fd = c->socket->query_fd());    res = sprintf("sql_result state: %d numrows: %d eof: %d inflight: %d\n"    "query: %O\n" + #if PG_DEBUGHISTORY > 0 +  "history: %O\n" + #endif    "fd: %O portalname: %O datarows: %d"    " synctransact: %d laststatus: %s\n",    _state, index, eoffound, inflight, -  qalreadyprinted == this ? "..." : _query, fd, _portalname, +  qalreadyprinted == this ? "..." : _query, + #if PG_DEBUGHISTORY > 0 +  qalreadyprinted == this ? 0 : c && c->i->history, + #endif +  fd, _portalname,    datarowtypes && sizeof(datarowtypes), _synctransact,    statuscmdcomplete    || (_unnamedstatementkey ? "*parsing*" : ""));    qalreadyprinted = this;    break;    }    return res;    }       protected void create(proxy _pgsqlsess, conxion _c, string query,