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

version» Context lines:

pike.git/lib/modules/Sql.pmod/pgsql.pike:605:    if(user)    plugbuffer->add("user\0",user,0);    if(database)    plugbuffer->add("database\0",database,0);    _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))) { - #ifdef PG_DEBUG -  if(!_options) -  PD("_options is zero, %O\n",this); - #endif -  if(_options && _options.reconnect) // FIXME why can _options be 0? +  if(this) // Only when not destructed yet +  if(_options.reconnect)    _connectfail();    else    destruct(waitforauthready); -  } else // Do not flush at this point, PostgreSQL 9.4 disapproves +  return; +  } +  } // Do not flush at this point, PostgreSQL 9.4 disapproves    procmessage();   } - } +       private void procmessage() {    int terminating=0;    .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) {
pike.git/lib/modules/Sql.pmod/pgsql.pike:1167:    or._delayederror=err;    if(objectp(portal))    portal->_releasesession();    portal=0;    if(!waitforauthready)    continue; // Only continue if authentication did not fail    }    break;    }    PD("Closing database processloop %O\n",err); +  if(this)    _delayederror=err;    for(;objectp(portal);portal=qportals->read())    if(objectp(portal)) {   #ifdef PG_DEBUG    showportal(0);   #endif    portal->_purgeportal();    }    if(!ci->close() && !terminating && _options.reconnect)    _connectfail(); -  else +  else if(this)    destruct(waitforauthready); -  if(err && !stringp(err)) +  if(this && err && !stringp(err))    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() {