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

version» Context lines:

pike.git/lib/modules/Sql.pmod/pgsql.pike:306:   //! Cancels all currently running queries in this session.   //!   //! @seealso   //! @[reload()], @[resync()]   //!   //! @note   //! This function is PostgreSQL-specific, and thus it is not available   //! through the generic SQL-interface.   /*semi*/final void cancelquery() {    PD("CancelRequest\n"); -  .pgsql_util.conxion lcon=getsocket(1); +  .pgsql_util.conxion lcon=getsocket(2);    lcon->add_int32(16)->add_int32(PG_PROTOCOL(1234,5678))    ->add_int32(backendpid)->add(cancelsecret)->sendcmd(FLUSHSEND);    lcon=0;   #ifdef PG_DEBUGMORE    PD("Closetrace %O\n",backtrace());   #endif    if(c) {    .pgsql_util.conxion plugbuffer;    if(!catch(plugbuffer=c->start(1))) {    foreach(qportals->peek_array();;int|.pgsql_util.sql_result portal)
pike.git/lib/modules/Sql.pmod/pgsql.pike:610:    _options.reconnect=undefinedp(_options.reconnect) || _options.reconnect;    foreach(_options-.pgsql_util.censoroptions; string name; mixed value)    plugbuffer->add(name,0,(string)value,0);    plugbuffer->add_int8(0);    PD("%O\n",(string)plugbuffer);    if(catch(ci->start()->add_hstring(plugbuffer,4,4)->sendcmd(SENDOUT))) {    if(_options.reconnect)    _connectfail();    else    destruct(waitforauthready); +  unnamedstatement=0;    termlock=0;    return;    }    } // Do not flush at this point, PostgreSQL 9.4 disapproves    procmessage();   }      private void procmessage() { -  +  mixed err;    int terminating=0; -  +  err = catch {    .pgsql_util.conxion ci=c; // cache value FIXME sensible?    .pgsql_util.conxiin cr=ci->i; // cache value FIXME sensible? -  mixed err; +    #ifdef PG_DEBUG    PD("Processloop\n");       void showportal(int msgtype) {    if(objectp(portal))    PD("%d<%O %d %c switch portal\n",    ci->socket->query_fd(),portal._portalname,++ci->queueinidx,msgtype);    else if(portal>0)    PD("%d<Sync %d %d %c portal\n",    ci->socket->query_fd(),++ci->queueinidx,portal,msgtype);
pike.git/lib/modules/Sql.pmod/pgsql.pike:1183:   #endif    portal->_purgeportal();    }    if(!terminating && _options.reconnect)    _connectfail();    else    destruct(waitforauthready);    termlock=0;    if(err && !stringp(err))    throw(err); +  }; +  if (err) { +  unnamedstatement=0; +  termlock = 0; +  throw(err);    } -  + }      //! Closes the connection to the database, any running queries are   //! terminated instantly.   //!   //! @note   //! This function is PostgreSQL-specific, and thus it is not available   //! through the generic SQL-interface.   /*semi*/final void close() {    if(qportals && qportals->size())    catch(cancelquery()); -  +  if (unnamedstatement)    termlock=unnamedstatement->lock(1);    c->close(); -  +  if (unnamedstatement)    unnamedstatement->lock(1);    destruct(c);destruct(waitforauthready);   }      protected void destroy() {    catch(close());    .pgsql_util.unregister_backend();   }      final void _connectfail(void|mixed err) {