pike.git
/
lib
/
modules
/
Sql.pmod
/
pgsql.pike
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/lib/modules/Sql.pmod/pgsql.pike:59:
#include "pgsql.h" #define ERROR(X ...) predef::error(X) final int _fetchlimit=FETCHLIMIT; final Thread.Mutex _unnamedportalmux; private Thread.Mutex unnamedstatement; private Thread.MutexKey termlock; final int _portalsinflight;
+
final int _wasparallelisable;
private .pgsql_util.conxion c; private string cancelsecret; private int backendpid, backendstatus; final mapping(string:mixed) _options; private array(string) lastmessage=({}); private int clearmessage; private mapping(string:array(mixed)) notifylist=([]); final mapping(string:string) _runtimeparameter; final mapping(string:mapping(string:mixed)) _prepareds=([]);
pike.git/lib/modules/Sql.pmod/pgsql.pike:1295:
_readyforquerycount=1; _waittocommit=0; qportals->write(1); if(!(c=getsocket())) ERROR("Couldn't connect to database on %s:%d\n",_host,_port); _runtimeparameter=([]); _unnamedportalmux=Thread.Mutex(); unnamedstatement=Thread.Mutex(); readyforquery_cb=recon?reconnect_cb:connect_cb; _portalsinflight=0;
+
_wasparallelisable = 0;
return 1; } //! For PostgreSQL this function performs the same function as @[resync()]. //! //! @seealso //! @[resync()], @[cancelquery()] /*semi*/final void reload() { resync(); }
pike.git/lib/modules/Sql.pmod/pgsql.pike:1881:
if(totalhits>=cachedepth) foreach(_prepareds;string ind;tp) { 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; } else _prepareds[q]=tp=([]); } if(invalidatecache) { invalidatecache=0; foreach(_prepareds;;mapping np) { closestatement(plugbuffer,np.preparedname); m_delete(np,"preparedname");
pike.git/lib/modules/Sql.pmod/pgsql.pike:1912:
portal=.pgsql_util.sql_result(this,c,q, 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
();
+
portal->_
parseportal
();
portal->_bindportal();
_readyforquerycount++; Thread.MutexKey lock=unnamedstatement->lock(1); .pgsql_util.conxsess cs = c->start(1); CHAIN(cs)->add_int8('Q')->add_hstring(({q, 0}), 4, 4); cs->sendcmd(FLUSHLOGSEND,portal); lock=0; PD("Simple query: %O\n",q); } else { object plugbuffer;
-
+
portal->_parseportal();
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++); PD("Parse statement %O=%O\n",preparedname,q); plugbuffer = c->start(); CHAIN(plugbuffer)->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