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

version» Context lines:

pike.git/lib/modules/Sql.pmod/pgsql.pike:1021:   //! 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.   void close()   { cancelquery();    if(_c)    _c.sendterminate(); +  _c=0;   }      void destroy()   { close();   }      private int reconnect(void|int force)   { Thread.MutexKey connectmtxkey;    if(_c)    { reconnected++;    prepstmtused=0;    if(!force)    _c.sendterminate(); -  _c.close(); _c=0; +  else +  _c.close(); +  _c=0;    foreach(prepareds;;mapping tp)    m_delete(tp,"preparedname");    if(!(connectmtxkey = _stealmutex.trylock(2)))    return 0; // Recursive reconnect, bailing out    }    if(!(_c=getsocket()))    { string msg=sprintf("Couldn't connect to database on %s:%d",host,port);    if(force)    { lastmessage+=({msg});    return 0;