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

version» Context lines:

pike.git/lib/modules/Sql.pmod/pgsql.pike:157:   //! will be SSL encrypted, if not, the connection will fallback   //! to plain unencrypted.   //! @member int "force_ssl"   //! If the database supports and allows SSL connections, the session   //! will be SSL encrypted, if not, the connection will abort.   //! @member int "text_query"   //! Send queries to and retrieve results from the database using text   //! instead of the, generally more efficient, default native binary method.   //! Turning this on will allow multiple statements per query separated   //! by semicolons. + //! @member int "sync_parse" + //! Set it to zero to turn synchronous parsing off for statements. + //! Setting this to off can cause surprises because statements could + //! be parsed before the previous statements have been executed. + //! This can speed up parsing by increased parallelism.   //! @member int "cache_autoprepared_statements"   //! If set to zero, it disables the automatic statement prepare and   //! cache logic; caching prepared statements can be problematic   //! when stored procedures and tables are redefined which leave stale   //! references in the already cached prepared statements.   //! @member string "client_encoding"   //! Character encoding for the client side, it defaults to using   //! the default encoding specified by the database, e.g.   //! @expr{"UTF8"@} or @expr{"SQL_ASCII"@}.   //! @member string "standard_conforming_strings"
pike.git/lib/modules/Sql.pmod/pgsql.pike:785: Inside #if defined(PG_DEBUG)
   PD("<CloseComplete\n");    msglen-=4;   #endif    break;    case 'Z':    backendstatus=ci->read_int8();   #ifdef PG_DEBUG    msglen-=4+1;    PD("<ReadyForQuery %c\n",backendstatus);   #endif -  for(;objectp(portal);portal->read()) { +  for(;objectp(portal);portal=qportals->read()) {   #ifdef PG_DEBUG    showportal(msgtype);   #endif    portal->_purgeportal();    }    foreach(qportals->peek_array();;.pgsql_util.pgsql_result qp) {    if(objectp(qp) && qp._synctransact && qp._synctransact<=portal) {    PD("Checking portal %O %d<=%d\n",    qp._portalname,qp._synctransact,portal);    qp->_purgeportal();
pike.git/lib/modules/Sql.pmod/pgsql.pike:1754:   //! Special bindings supported are:   //! @mapping   //! @member int ":_cache"   //! Forces caching on or off for the query at hand.   //! @member int ":_text"   //! Forces text mode in communication with the database for queries on or off   //! for the query at hand. Potentially more efficient than the default   //! binary method for simple queries with small or no result sets.   //! Note that this mode causes all but the first query result of a list   //! of semicolon separated statements to be discarded. + //! @member int ":_sync" + //! Forces synchronous parsing on or off for statements. + //! Setting this to off can cause surprises because statements could + //! be parsed before the previous statements have been executed. + //! This can speed up parsing by increased parallelism.   //! @endmapping   //!   //! @returns   //! A @[Sql.pgsql_util.pgsql_result] object (which conforms to the   //! @[Sql.sql_result] standard interface for accessing data). It is   //! recommended to use @[Sql.Sql()->query()] for simpler queries (because   //! it is easier to handle, but stores all the result in memory), and   //! @[Sql.Sql()->big_query()] for queries you expect to return huge amounts of   //! data (it's harder to handle, but fetches results on demand).   //!
pike.git/lib/modules/Sql.pmod/pgsql.pike:1789:   //! @ref{:_text@} option.   //!   //! @seealso   //! @[big_typed_query()], @[Sql.Sql], @[Sql.sql_result],   //! @[Sql.Sql()->query()], @[Sql.pgsql_util.pgsql_result]   .pgsql_util.pgsql_result big_query(string q,    void|mapping(string|int:mixed) bindings,    void|int _alltyped) {    throwdelayederror(this);    string preparedname=""; -  int forcecache=-1; -  int forcetext=options.text_query; +  int forcecache=-1, forcetext=options.text_query; +  int syncparse=zero_type(options.sync_parse)?-1:options.sync_parse;    if(waitforauthready)    waitauthready();    string cenc=_runtimeparameter[CLIENT_ENCODING];    switch(cenc) {    case UTF8CHARSET:    q=string_to_utf8(q);    break;    default:    if(String.width(q)>8)    ERROR("Don't know how to convert %O to %s encoding\n",q,cenc);
pike.git/lib/modules/Sql.pmod/pgsql.pike:1824:    if(name[0]!=':')    name=":"+name;    if(name[1]=='_') { // Special option parameter    switch(name) {    case ":_cache":    forcecache=(int)value;    break;    case ":_text":    forcetext=(int)value;    break; +  case ":_syncparse": +  syncparse=(int)value; +  break;    }    continue;    }    if(!has_value(q,name))    continue;    }    from[rep]=name;    string rval;    if(multisetp(value)) // multisets are taken literally    rval=indices(value)*","; // and bypass the encoding logic
pike.git/lib/modules/Sql.pmod/pgsql.pike:1922:    Thread.MutexKey lock=unnamedstatement->lock(1);    c->start(1)->add_int8('Q')->add_hstring(q,4,4+1)->add_int8(0)    ->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=unnamedstatement->trylock(1)) +  (portal._unnamedstatementkey= +  (syncparse?unnamedstatement->lock:unnamedstatement->trylock)(1))    ? "" : PTSTMTPREFIX+int2hex(ptstmtcount++);    // 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    PD("Parse statement %O=%O\n",preparedname,q);    plugbuffer=c->start()->add_int8('P')    ->add_hstring(({preparedname,0,q,"\0\0\0"}),4,4)->add(PGFLUSH);    }    if(!tp || !tp.datatypeoid) {