pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:1963:
termlock = 0;
return;
} else {
CHAIN(cs)->add_hstring(plugbuffer, 4, 4);
cs->sendcmd(SENDOUT);
}
} // Do not flush at this point, PostgreSQL 9.4 disapproves
procmessage();
}
+ private void stasherror(int|object portal, mixed err) {
+ if (stringp(err)) {
+ if (!objectp(portal))
+ portal = this;
+ if (!portal->delayederror)
+ portal->delayederror = err;
+ }
+ if (objectp(portal))
+ portal->_purgeportal();
+ }
+
+ private void tryprepbind(sql_result portal, array dtoid) {
+ mixed err = catch(portal->_preparebind(dtoid));
+ if (err) {
+ stasherror(portal, err);
+ if (!stringp(err))
+ throw(err);
+ }
+ }
+
private void procmessage() {
mixed err;
int terminating = 0;
err = catch {
conxion ci = c; // cache value
conxiin cr = ci->i; // cache value
#ifdef PG_DEBUG
PD("Processloop\n");
#ifdef PG_DEBUGMORE
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:2292: Inside #if defined(PG_DEBUG)
msglen -= 4 + 2 + 4 * cols;
a = cr->read_ints(cols, 4);
#else
a = cr->read_ints(cr->read_int16(), 4);
#endif
#ifdef PG_DEBUGMORE
PD("%O\n", a);
#endif
if (portal._tprepared)
portal._tprepared.datatypeoid = a;
- Thread.Thread(portal->_preparebind, a);
+ Thread.Thread(tryprepbind, portal, a);
break;
}
case 'T': {
array a, at;
int cols = cr->read_int16();
#ifdef PG_DEBUG
PD("RowDescription %d columns %O\n", cols, portal._query);
msglen -= 4 + 2;
#endif
at = allocate(cols);
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:2622:
}; // We only get here if there is an error
if (err == MAGICTERMINATE) { // Announce connection termination to server
catch {
void|bufcon|conxsess cs = ci->start();
CHAIN(cs)->add(PGSYNC)->add("X\0\0\0\4");
cs->sendcmd(SENDOUT);
};
terminating = 1;
err = 0;
} else if (stringp(err)) {
- sql_result or;
- if (!objectp(or = portal))
- or = this;
- if (!or.delayederror)
- or.delayederror = err;
+
#ifdef PG_DEBUGMORE
showportalstack("THROWN");
#endif
- if (objectp(portal))
- portal->_releasesession("ERROR");
+ stasherror(portal, err);
portal = 0;
if (!waitforauthready)
continue; // Only continue if authentication did not fail
}
break;
}
PD("Closing database processloop %s\n", err ? describe_backtrace(err) : "");
delayederror = err;
if (objectp(portal)) {
#ifdef PG_DEBUG