Branch: Tag:

2020-02-25

2020-02-25 01:10:52 by Stephen R. van den Berg <srb@cuci.nl>

pgsql: Simplify error handling for users.

211:   //! @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);   }   
497:      private void reset_dbsession() {    proxy.statementsinflight->wait_till_drained(); -  proxy.delayederror = 0; +     error(1);    big_query("ROLLBACK");    big_query("RESET ALL");
1039:   /*semi*/final .pgsql_util.sql_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;
1124:    */    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