pike.git
/
lib
/
modules
/
Sql.pmod
/
pgsql_util.pmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:1677:
|| transtype == TRANSEND ? SYNCSEND : FLUSHSEND; } else inflight += fetchlimit, flushmode = FLUSHSEND; plugbuffer->sendcmd(flushmode, this); } inline private array setuptimeout() { return local_backend->call_out(gottimeout, timeout); }
-
inline void scuttletimeout(array cid) {
+
inline
private
void scuttletimeout(array cid) {
if (local_backend) local_backend->remove_call_out(cid); } //! @returns //! One result row at a time. //! //! When using COPY FROM STDOUT, this method returns one row at a time //! as a single string containing the entire row. //!
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:1700:
/*semi*/final array(mixed) fetch_row() { int|array datarow; replenishrows(); if (arrayp(datarow = datarows->try_read())) return datarow; if (!eoffound) { if (!datarow) { PD("%O Block for datarow\n", _portalname); array cid = setuptimeout(); PT(datarow = datarows->read());
+
if (!this) // If object already destructed, return fast
+
return 0;
scuttletimeout(cid); if (arrayp(datarow)) return datarow; } eoffound = 1; datarows->write(1); // Signal EOF for other threads } trydelayederror(); return 0; }
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:1727:
//! @seealso //! @[eof()], @[fetch_row()] /*semi*/final array(array(mixed)) fetch_row_array() { if (eoffound) return 0; replenishrows(); array(array|int) datarow = datarows->try_read_array(); if (!sizeof(datarow)) { array cid = setuptimeout(); PT(datarow = datarows->read_array());
+
if (!this) // If object already destructed, return fast
+
return 0;
scuttletimeout(cid); } replenishrows(); if (arrayp(datarow[-1])) return datarow; do datarow = datarow[..<1]; // Swallow EOF mark(s) while (sizeof(datarow) && !arrayp(datarow[-1])); trydelayederror(); eoffound = 1; datarows->write(1); // Signal EOF for other threads
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:1770:
_releasesession(); } private void run_result_cb( function(Result, array(mixed), mixed ...:void) callback, array(mixed) args) { int|array datarow; for (;;) { array cid = setuptimeout(); PT(datarow = datarows->read());
+
if (!this) // If object already destructed, return fast
+
return 0;
scuttletimeout(cid); if (!arrayp(datarow)) break; callout(callback, 0, this, datarow, @args); } eoffound = 1; callout(callback, 0, this, 0, @args); } //! Sets up a callback for every row returned from the database.
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:1799:
Thread.Thread(run_result_cb, callback, args); } private void run_result_array_cb( function(Result, array(array(mixed)), mixed ...:void) callback, array(mixed) args) { array(array|int) datarow; for (;;) { array cid = setuptimeout(); PT(datarow = datarows->read_array());
+
if (!this) // If object already destructed, return fast
+
return 0;
scuttletimeout(cid); if (!datarow || !arrayp(datarow[-1])) break; callout(callback, 0, this, datarow, @args); } eoffound = 1; if (sizeof(datarow)>1) callout(callback, 0, this, datarow = datarow[..<1], @args); callout(callback, 0, this, 0, @args); }