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

version» Context lines:

pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:623:    if (!result.datarowtypes) {    result.datarowtypes = emptyarray;    if (result._state != PURGED && !result.delayederror)    result.delayederror = LOSTERROR;    result._ddescribe->broadcast();    runningportals[result] = 0;    } else    destruct(result);    };    destruct(nostash); +  if (socket->set_non_blocking)    socket->set_non_blocking(); // Drop all callbacks    PD("%d>Close socket\n", socket->query_fd());    socket->close(); // This will be an asynchronous close    }    destruct(this);    }    }       private void destroy() {    PD("%d>Close conxion %d\n", socket ? socket->query_fd() : -1, !!nostash);
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:1351:    } else if (syncparse < 0 && !pgsqlsess->wasparallelisable    && !pgsqlsess->statementsinflight->drained(1)) {    lock = 0;    PD("Commit waiting for statements to finish\n");    catch(PT(pgsqlsess->statementsinflight->wait_till_drained(1)));    }    PD("Bind portal %O statement %O\n", _portalname, _preparedname);    _fetchlimit = pgsqlsess->_fetchlimit;    _bindportal();    conxsess bindbuffer = c->start(); -  _unnamedstatementkey = 0; +     stmtifkey = 0;    CHAIN(bindbuffer)->add_int8('B')->add_hstring(plugbuffer, 4, 4);    if (!_tprepared && sizeof(_preparedname))    closestatement(CHAIN(bindbuffer), _preparedname);    _sendexecute(_fetchlimit    && !(transtype != NOTRANS    || sizeof(_query) >= MINPREPARELENGTH &&    execfetchlimit->match(_query))    && _fetchlimit, bindbuffer); -  +  _unnamedstatementkey = 0;    }    }    }       final void _processrowdesc(array(mapping(string:mixed)) datarowdesc,    array(int) datarowtypes) {    _setrowdesc(datarowdesc, datarowtypes);    if (_tprepared) {    _tprepared.datarowdesc = datarowdesc;    _tprepared.datarowtypes = datarowtypes;
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:1497:    }       private void releaseconditions() {    _unnamedportalkey = _unnamedstatementkey = 0;    if (!datarowtypes) {    if (_state != PURGED && !delayederror)    delayederror = LOSTERROR;    datarowtypes = emptyarray;    _ddescribe->broadcast();    } -  if (delayederror && !pgsqlsess.delayederror) +  if (delayederror && pgsqlsess && !pgsqlsess.delayederror)    pgsqlsess.delayederror = delayederror; // Preserve error upstream    pgsqlsess = 0;    }       final void _releasesession(void|string statusccomplete) {    c->runningportals[this] = 0;    if (statusccomplete && !statuscmdcomplete) {    Thread.MutexKey lock = _ddescribemux->lock();    statuscmdcomplete = statusccomplete;    _ddescribe->broadcast();
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:1525:    if (_state < CLOSED) {    stmtifkey = 0;    _state = CLOSED;    }    datarows->write(1); // Signal EOF    releaseconditions();    }       protected void destroy() {    catch { // inside destructors, exceptions don't work -  _releasesession(); +  _releasesession("ABORT");    };    }       final void _sendexecute(int fetchlimit,    void|array(Thread.MutexKey)|bufcon|conxsess plugbuffer) {    int flushmode;    array(Thread.MutexKey) reflock;    PD("Execute portal %O fetchlimit %d transtype %d\n", _portalname,    fetchlimit, transtype);    if (arrayp(plugbuffer)) {
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:2556:    } else if (stringp(err)) {    sql_result or;    if (!objectp(or = portal))    or = this;    if (!or.delayederror)    or.delayederror = err;   #ifdef PG_DEBUGMORE    showportalstack("THROWN");   #endif    if (objectp(portal)) -  portal->_releasesession(); +  portal->_releasesession("ERROR");    portal = 0;    if (!waitforauthready)    continue; // Only continue if authentication did not fail    }    break;    }    PD("Closing database processloop %s\n", err ? describe_backtrace(err) : "");    delayederror = err;    if (objectp(portal)) {   #ifdef PG_DEBUG