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

version» Context lines:

pike.git/lib/modules/Sql.pmod/pgsql.pike:1027:   void close()   { cancelquery();    if(_c)    _c.sendterminate();   }      void destroy()   { close();   }    - private void reconnect(void|int force) + private int reconnect(void|int force)   { Thread.MutexKey connectmtxkey;    if(_c)    { reconnected++;    prepstmtused=0;    if(!force)    _c.sendterminate();    _c.close(); _c=0;    foreach(prepareds;;mapping tp)    m_delete(tp,"preparedname");    if(!(connectmtxkey = _stealmutex.trylock(2)))
pike.git/lib/modules/Sql.pmod/pgsql.pike:1068:    foreach(options-(<"use_ssl","force_ssl","cache_autoprepared_statements">);    string name;mixed value)    plugbuf+=({name,"\0",(string)value,"\0"});    plugbuf+=({"\0"});    int len=4;    foreach(plugbuf;;string s)    len+=sizeof(s);    plugbuf[0]=_c.plugint32(len);    _c.write(plugbuf);    PD("%O\n",plugbuf); -  _decodemsg(readyforquery); +  { mixed err=catch(_decodemsg(readyforquery)); +  if(err) +  if(force) +  return 0; +  else +  throw(err); +  }    PD("%O\n",_runtimeparameter);    if(force)    { lastmessage+=({sprintf("Reconnected to database %s",host_info())});    runcallback(backendpid,"_reconnect","");    } -  +  return 1;   }      //! @decl void reload()   //!   //! For PostgreSQL this function performs the same function as @[resync()].   //!   //! @seealso   //! @[resync()], @[cancelquery()]   void reload()   { resync();