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

version» Context lines:

pike.git/lib/modules/Sql.pmod/pgsql.pike:1897:    if(sizeof(plugbuffer)) {    PD("%O\n",(string)plugbuffer);    plugbuffer->sendcmd(FLUSHSEND); // close expireds    } else    plugbuffer->sendcmd(KEEP); // close start()    tstart=gethrtime();    } else // sql_result autoassigns to portal    tp=UNDEFINED;    .pgsql_util.sql_result portal;    portal=.pgsql_util.sql_result(this,c,q, -  portalbuffersize,_alltyped,from,forcetext,timeout); +  portalbuffersize, _alltyped, from, forcetext, timeout, syncparse);    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);    portal._portalname="";    portal->_openportal();    _readyforquerycount++;    Thread.MutexKey lock=unnamedstatement->lock(1);    c->start(1)->add_int8('Q')->add_hstring(({q,0}),4,4)    ->sendcmd(FLUSHLOGSEND,portal);    lock=0;    PD("Simple query: %O\n",q);    } else {    object plugbuffer;    if(!sizeof(preparedname) || !tp || !tp.preparedname) {    if(!sizeof(preparedname))    preparedname= -  (portal._unnamedstatementkey= -  (syncparse?unnamedstatement->lock:unnamedstatement->trylock)(1)) +  (portal._unnamedstatementkey = unnamedstatement->trylock(1))    ? "" : PTSTMTPREFIX+int2hex(ptstmtcount++); -  else if(syncparse) -  portal._unnamedstatementkey=unnamedstatement->lock(1); +     PD("Parse statement %O=%O\n",preparedname,q);    plugbuffer=c->start()->add_int8('P')    ->add_hstring(({preparedname,0,q,"\0\0\0"}),4,4)   #if 0    // Even though the protocol doesn't require the Parse command to be    // followed by a flush, it makes a VERY noticeable difference in    // performance if it is omitted; seems like a flaw in the PostgreSQL    // server v8.3.3    // In v8.4 and later, things speed up slightly when it is omitted.    ->add(PGFLUSH)