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:97:
int _packetssent; // Number of packets sent int _bytessent; // Number of bytes sent private int warningsdropcount; // Number of uncollected warnings private int prepstmtused; // Number of times prepared statements were used private int warningscollected; private int invalidatecache; private int connectionclosed; private string host, database, user, pass; private int port;
+
private multiset cachealways=(<"BEGIN","begin","END","end","COMMIT","commit">);
private object createprefix =Regexp("^[ \t\f\r\n]*[Cc][Rr][Ee][Aa][Tt][Ee][ \t\f\r\n]"); private object dontcacheprefix =Regexp("^[ \t\f\r\n]*([Ff][Ee][Tt][Cc][Hh]|[Cc][Oo][Pp][Yy])[ \t\f\r\n]");
-
private object
limitpostfix
-
=Regexp("[ \t\f\r\n][Ll][Ii][Mm][Ii][Tt][ \t\f\r\n]+[12][; \t\f\r\n]*$");
+
private object
execfetchlimit
+
=Regexp("
^
[ \t\f\r\n]
*((
[
Uu][Pp][Dd][Aa]|[Dd][Ee][
Ll][
Ee])[Tt][Ee]|\
+
[
Ii][
Nn][Ss][Ee][Rr][Tt])[ \t\f\r\n]|\
+
[ \t\f\r\n][Ll][Ii][
Mm][Ii][Tt][ \t\f\r\n]+[12][; \t\f\r\n]*$");
Thread.Mutex _querymutex; Thread.Mutex _stealmutex; #define USERERROR(msg) throw(({(msg), backtrace()[..<1]})) protected string _sprintf(int type, void|mapping flags) { string res=UNDEFINED; switch(type) { case 'O': res=sprintf(DRIVERNAME"(%s@%s:%d/%s,%d)",
pike.git/lib/modules/Sql.pmod/pgsql.pike:1676:
from=({from,to,paramValues}); } else paramValues = ({}); if(String.width(q)>8) ERROR("Wide string literals in %O not supported\n",q); if(has_value(q,"\0")) ERROR("Querystring %O contains invalid literal nul-characters\n",q); mapping(string:mixed) tp; int tstart;
-
if(forcecache==1 || forcecache!=0 && sizeof(q)>=MINPREPARELENGTH)
+
if(forcecache==1
+
|| forcecache!=0 &&
(
sizeof(q)>=MINPREPARELENGTH
|| cachealways[q]
)
)
{ array(string) plugbuf=({}); if(tp=prepareds[q]) { if(tp->preparedname) prepstmtused++, preparedname=tp->preparedname; else if((tstart=tp->trun) && tp->tparse*FACTORPLAN>=tstart && (zero_type(options->cache_autoprepared_statements) || options->cache_autoprepared_statements)) preparedname=PREPSTMTPREFIX+(string)pstmtcount++; }
pike.git/lib/modules/Sql.pmod/pgsql.pike:1907:
} plugbuf[1]=_c.plugint32(len); PD("Bind portal %s statement %s\n",portalname,preparedname); _c.sendcmd(plugbuf); #ifdef DEBUGMORE PD("%O\n",plugbuf); #endif } _c.portal->_statuscmdcomplete=UNDEFINED; _sendexecute(_fetchlimit
-
&& !
limitpostfix->match
(q
)
// Optimisation for LIMIT 1
+
&& !(
cachealways[
q
]
+
||
sizeof(q)>=MINPREPARELENGTH
&&
execfetchlimit->match(q))
&& FETCHLIMITLONGRUN); if(tp) { _decodemsg(bindcomplete); int tend=gethrtime(); if(tend==tstart) m_delete(prepareds,q); else { tp->hits++; totalhits++; if(!tp->preparedname)