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

version» Context lines:

pike.git/lib/modules/Sql.pmod/pgsql.pike:227:    void|string _user, void|string _pass, void|mapping(string:mixed) _options)   { pass = _pass; _pass = "CENSORED";    if(pass)    String.secure(pass);    user = _user; database = _database; host = _host || PGSQL_DEFAULT_HOST;    options = _options || ([]);    if(has_value(host,":") && sscanf(_host,"%s:%d",host,port)!=2)    ERROR("Error in parsing the hostname argument\n");    if(!port)    port = PGSQL_DEFAULT_PORT; +  _runtimeparameter=([]);    _querymutex=Thread.Mutex();    _stealmutex=Thread.Mutex();    reconnect();   }      //! @returns   //! The textual description of the last   //! server-related error. Returns @expr{0@} if no error has occurred   //! yet. It is not cleared upon reading (can be invoked multiple   //! times, will return the same result until a new error occurs).
pike.git/lib/modules/Sql.pmod/pgsql.pike:591:   final private string pinpointerror(void|string query,void|string offset)   { if(!query)    return "";    int k=(int)offset;    if(k<=0)    return MARKSTART+query+MARKEND;    return MARKSTART+(k>1?query[..k-2]:"")+MARKERROR+query[k-1..]+MARKEND;   }      private void phasedreconnect() + { if(!connectionclosed)    { connectionclosed=1;    if(!reconnect(1))    { sleep(RECONNECTDELAY);    if(!reconnect(1))    { sleep(RECONNECTBACKOFF);    reconnect(1);    }    }    } -  + }      final int _decodemsg(void|state waitforstate)   {   #ifdef DEBUG    { array line;   #ifdef DEBUGMORE    line=backtrace();   #endif    PD("Waiting for state %O %O\n",waitforstate,line&&line[sizeof(line)-2]);    }
pike.git/lib/modules/Sql.pmod/pgsql.pike:985:    };    warningsdropcount+=warningscollected;    warningscollected=0;    switch(msgresponse->C)    { case "P0001":    lastmessage=({sprintf("%s: %s",msgresponse->S,msgresponse->M)});    USERERROR(a2nls(lastmessage    +({pinpointerror(_c.portal->_query,msgresponse->P)})    +showbindings()));    case "57P01":case "57P02":case "57P03": -  preplastmessage();phasedreconnect(); -  PD(a2nls(lastmessage)); +  preplastmessage();phasedreconnect();PD(a2nls(lastmessage));    USERERROR(a2nls(lastmessage));    case "08P01":case "42P05":    errtype=protocolerror;    case "XX000":case "42883":case "42P01":    invalidatecache=1;    default:    preplastmessage();    if(msgresponse->D)    lastmessage+=({msgresponse->D});    if(msgresponse->H)
pike.git/lib/modules/Sql.pmod/pgsql.pike:1133:    { if(!sizeof(lastmessage) || lastmessage[sizeof(lastmessage)-1]!=msg)    lastmessage+=({msg});    return 0;    }    else    ERROR(msg+"\n");    }    _closesent=0;    _mstate=unauthenticated;    qstate=queryidle; -  _runtimeparameter=([]); +  portalsinflight=unnamedportalinuse=0;    array(string) plugbuf=({"",_c.plugint32(PG_PROTOCOL(3,0))});    if(user)    plugbuf+=({"user\0",user,"\0"});    if(database)    plugbuf+=({"database\0",database,"\0"});    options->reconnect=zero_type(options->reconnect) || options->reconnect; -  foreach(options +  foreach((options+_runtimeparameter)    -(<"use_ssl","force_ssl","cache_autoprepared_statements","reconnect",    "text_query">);    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);
pike.git/lib/modules/Sql.pmod/pgsql.pike:1202:   //!   //! @seealso   //! @[cancelquery()], @[reload()]   //!   //! @note   //! This function is PostgreSQL-specific, and thus it is not available   //! through the generic SQL-interface.   void resync(void|int special)   { mixed err;    int didsync; +  if(!is_open()&&!reconnect(1)) +  ERROR(a2nls(lastmessage));    if(err = catch    { sendclose(1);    PD("Portalsinflight: %d\n",portalsinflight);    if(!portalsinflight)    { if(!earlyclose)    { PD("Sync\n");    _c.sendcmd(({"S",_c.plugint32(4)}),2);    }    didsync=1;    if(!special)