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

version» Context lines:

pike.git/lib/modules/Sql.pmod/pgsql.pike:67:   private int portalsinflight;      object _c;   private string SSauthdata,cancelsecret;   private int backendpid;   private int backendstatus;   private mapping(string:mixed) options;   private array(string) lastmessage=({});   private int clearmessage;   private int earlyclose; + private int reconnectp;   private mapping(string:array(mixed)) notifylist=([]);   mapping(string:string) _runtimeparameter;   state _mstate;   private enum querystate {queryidle,inquery,cancelpending,canceled};   private querystate qstate;   private mapping(string:mapping(string:mixed)) prepareds=([]);   private mapping(string:mixed) tprepared;   private int pstmtcount;   private int pportalcount;   private int totalhits;
pike.git/lib/modules/Sql.pmod/pgsql.pike:169:   //!   //! @param database   //! Specifies the database to connect to. Not specifying this is   //! only supported if the PostgreSQL backend has a default database   //! configured. If you do not want to connect to any live database,   //! you can use @expr{"template1"@}.   //!   //! @param options   //! Currently supports at least the following:   //! @mapping + //! @member int "reconnect" + //! Set it to zero to disable automatic reconnects upon losing + //! the connection to the database   //! @member int "use_ssl"   //! If the database supports and allows SSL connections, the session   //! will be SSL encrypted, if not, the connection will fallback   //! to plain unencrypted   //! @member int "force_ssl"   //! If the database supports and allows SSL connections, the session   //! will be SSL encrypted, if not, the connection will abort   //! @member int "cache_autoprepared_statements"   //! If set to zero, it disables the automatic statement prepare and   //! cache logic; caching prepared statements can be problematic
pike.git/lib/modules/Sql.pmod/pgsql.pike:1040:    if(_c)    { reconnected++;    prepstmtused=0;    if(!force)    _c.sendterminate();    else    _c.close();    _c=0;    foreach(prepareds;;mapping tp)    m_delete(tp,"preparedname"); -  if(!(connectmtxkey = _stealmutex.trylock(2))) +  if(!reconnectp || !(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;    }    else    ERROR(msg+"\n");    }    _closesent=0;    _mstate=unauthenticated;    qstate=queryidle;    _runtimeparameter=([]);    array(string) plugbuf=({"",_c.plugint32(PG_PROTOCOL(3,0))});    if(user)    plugbuf+=({"user\0",user,"\0"});    if(database)    plugbuf+=({"database\0",database,"\0"}); -  foreach(options-(<"use_ssl","force_ssl","cache_autoprepared_statements">); +  if(intp(options->reconnect)) +  reconnectp=options->reconnect; +  foreach(options +  -(<"use_ssl","force_ssl","cache_autoprepared_statements","reconnect">);    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);    { mixed err=catch(_decodemsg(readyforquery));