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

version» Context lines:

pike.git/lib/modules/Sql.pmod/pgsql.pike:207:   //!   //! @note   //! The string returned is not newline-terminated.   //!   //! @param clear   //! To clear the error, set it to @expr{1@}.   //!   //! @seealso   //! @[big_query()]   /*semi*/final string error(void|int clear) { -  throwdelayederror(proxy); +  mixed err = catch(throwdelayederror(proxy)); +  if (!clear && err) +  throw(err);    return proxy.geterror(clear);   }      //! This function returns a string describing what host are we talking to,   //! and how (TCP/IP or UNIX socket).   //!   //! @seealso   //! @[server_info()]   /*semi*/final string host_info() {    return proxy.host_info();
pike.git/lib/modules/Sql.pmod/pgsql.pike:493:   //! For PostgreSQL this function performs the same function as @[resync()].   //!   //! @seealso   //! @[resync()], @[cancelquery()]   /*semi*/final void reload() {    resync();   }      private void reset_dbsession() {    proxy.statementsinflight->wait_till_drained(); -  proxy.delayederror = 0; +     error(1);    big_query("ROLLBACK");    big_query("RESET ALL");    big_query("CLOSE ALL");    big_query("DISCARD TEMP");   }      private void resync_cb() {    switch (proxy.backendstatus) {    case 'T':case 'E':
pike.git/lib/modules/Sql.pmod/pgsql.pike:1035:   //! be viewed as a limited protection against SQL-injection attacks.   //! To make it support multiple queries in one querystring, use the   //! @ref{:_text@} option (not recommended).   //!   //! @seealso   //! @[big_typed_query()], @[Sql.Connection], @[Sql.Result],   //! @[query()], @[Sql.pgsql_util.Result]   /*semi*/final variant .pgsql_util.Result big_query(string q,    void|mapping(string|int:mixed) bindings,    void|int _alltyped) { -  throwdelayederror(proxy); +     string preparedname = "";    mapping(string:mixed) options = proxy.options;    .pgsql_util.conxion c = proxy.c;    int forcecache = -1, forcetext = options.text_query;    int syncparse = zero_type(options.sync_parse)    ? -1 : options.sync_parse;    if (proxy.waitforauthready)    waitauthready();    string cenc = proxy.runtimeparameter[CLIENT_ENCODING];    switch(cenc) {
pike.git/lib/modules/Sql.pmod/pgsql.pike:1120:    ERROR("Querystring %O contains invalid literal nul-characters\n", q);    mapping(string:mixed) tp;    /*    * FIXME What happens with regards to this detection when presented with    * multistatement text-queries?    * The primary function of this detection is to ensure a SYNC    * right after a COMMIT, and no SYNC after a BEGIN.    */    int transtype = .pgsql_util.transendprefix->match(q) ? TRANSEND    : .pgsql_util.transbeginprefix->match(q) ? TRANSBEGIN : NOTRANS; +  { +  int inerror = proxy.backendstatus == 'E'; +  if (inerror && transtype == TRANSEND) +  proxy.sendsync(); +  throwdelayederror(proxy); +  if (inerror && transtype != TRANSEND) +  ERROR("Current transaction is aborted, " +  "commands ignored until end of transaction"); +  }    if (transtype != NOTRANS)    tp = .pgsql_util.describenodata; // Description already known    else if (!forcetext && forcecache == 1    || forcecache && sizeof(q) >= MINPREPARELENGTH) {    object plugbuffer = c->start();    if (tp = proxy.prepareds[q]) {    if (tp.preparedname) {   #ifdef PG_STATS    prepstmtused++;   #endif