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

version» Context lines:

pike.git/lib/modules/Sql.pmod/pgsql.pike:1919:    if(has_value(q,"\0"))    ERROR("Querystring %O contains invalid literal nul-characters\n",q);    mapping(string:mixed) tp;    int tstart;    /*    * FIXME What happens with regards to this detection when presented with    * multistatement text-queries?    */    int transtype = .pgsql_util.transendprefix->match(q) ? TRANSEND    : .pgsql_util.transbeginprefix->match(q) ? TRANSBEGIN : NOTRANS; -  if(!forcetext && forcecache==1 -  || forcecache!=0 -  && (sizeof(q)>=MINPREPARELENGTH || transtype != NOTRANS)) { +  if (transtype != NOTRANS) +  tp = .pgsql_util.describenodata; // Description already known +  else if (!forcetext && forcecache == 1 +  || forcecache && sizeof(q) >= MINPREPARELENGTH) {    object plugbuffer;    while(catch(plugbuffer=c->start()))    reconnect();    if(tp=_prepareds[q]) {    if(tp.preparedname) {   #ifdef PG_STATS    prepstmtused++;   #endif    preparedname=tp.preparedname;    } else if((tstart=tp.trun)
pike.git/lib/modules/Sql.pmod/pgsql.pike:1949:    int oldhits=tp.hits;    totalhits-=oldhits-(tp.hits=oldhits>>1);    if(oldhits<=1) {    closestatement(plugbuffer,tp.preparedname);    m_delete(_prepareds,ind);    }    }    if(forcecache!=1 && .pgsql_util.createprefix->match(q)) {    PD("Invalidate cache\n");    invalidatecache=1; // Flush cache on CREATE -  tp=UNDEFINED; +  tp = 0;    } else    _prepareds[q]=tp=([]);    }    if(invalidatecache) {    invalidatecache=0;    foreach(_prepareds;;mapping np) {    closestatement(plugbuffer,np.preparedname);    m_delete(np,"preparedname");    }    }    if(sizeof(CHAIN(plugbuffer))) {    PD("%O\n",(string)CHAIN(plugbuffer));    plugbuffer->sendcmd(FLUSHSEND); // close expireds    } else    plugbuffer->sendcmd(KEEP); // close start()    tstart=gethrtime();    } else // sql_result autoassigns to portal -  tp=UNDEFINED; +  tp = 0;    .pgsql_util.sql_result portal;    portal=.pgsql_util.sql_result(this,c,q, portalbuffersize, _alltyped, from,    forcetext, timeout, syncparse, transtype);    portal._tprepared=tp;   #ifdef PG_STATS    portalsopened++;   #endif    clearmessage=1;    if(forcetext) { // FIXME What happens if portals are still open?    portal._unnamedportalkey=_unnamedportalmux->lock(1);