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:86:
} return 0; // text } protected sctype mergemode(PGassist realbuffer,sctype mode) { if(mode>realbuffer->stashflushmode) realbuffer->stashflushmode=mode; return realbuffer->stashflushmode; }
+
protected inline mixed callout(function(mixed ...:void) f,
+
float|int delay,mixed ... args) {
+
return local_backend->call_out(f,delay,@args);
+
}
+
// Some pgsql utility functions class PGplugbuffer { inherit Stdio.Buffer; protected PGassist realbuffer; protected void create(PGassist _realbuffer) { realbuffer=_realbuffer; }
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:183:
} protected bool range_error(int howmuch) { if(!howmuch) return false; #ifdef PG_DEBUG if(howmuch<0) error("Out of range %d\n",howmuch); #endif if(fillread) {
-
array cid=
local_backend->call_out
(gottimeout,timeout);
+
array cid=
callout
(gottimeout,timeout);
Thread.MutexKey lock=fillreadmux->lock(); fillread.wait(lock); lock=0; local_backend->remove_call_out(cid); } else throw(MAGICTERMINATE); return true; } protected int read_cb(mixed id,mixed b) {
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:645:
Thread.MutexKey lock=prepbuffermux->lock(); prepbufferready->signal(); lock=0; } } final void _processrowdesc(array(mapping(string:mixed)) datarowdesc) { _setrowdesc(datarowdesc); mapping(string:mixed) tp=_tprepared; // FIXME Is caching this worthwhile? if(!tp || !tp.datarowdesc)
-
Thread.Thread(gotdatarowdesc);
+
Thread.Thread(gotdatarowdesc);
// Do not use callout, it deadlocks
if(tp) tp.datarowdesc=datarowdesc; } protected void gotdatarowdesc() { if(!prepbuffer) { Thread.MutexKey lock=prepbuffermux->lock(); prepbufferready->wait(lock); lock=0; }
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:848:
c->start()->add_int8('d')->add_hstring(copydata,4,4)->sendcmd(sendout); } else _releasesession(); } protected void run_result_cb( function(pgsql_result, array(mixed), mixed ...:void) callback, array(mixed) args) { int|array datarow; while(arrayp(datarow=_datarows->read_array()))
-
callback
(this, datarow, @args);
+
callout(
callback
, 0,
this, datarow, @args);
trydelayederror(); eoffound=1;
-
callback
(this, 0, @args);
+
callout(
callback
, 0,
this, 0, @args);
} //! Sets up a callback for every row returned from the database. //! First argument passed is the resultobject itself, second argument //! is the result row (zero on EOF). //! //! @seealso //! @[fetch_row()] void set_result_callback( function(pgsql_result, array(mixed), mixed ...:void) callback, mixed ... args) { if(callback) Thread.Thread(run_result_cb,callback,args); } protected void run_result_array_cb( function(pgsql_result, array(array(mixed)), mixed ...:void) callback, array(mixed) args) { array(array|int) datarow; while((datarow=_datarows->read_array()) && arrayp(datarow[-1]))
-
callback
(this, datarow, @args);
+
callout(
callback
, 0,
this, datarow, @args);
trydelayederror(); eoffound=1; if(sizeof(datarow)>1)
-
callback
(this, datarow=datarow[..<1], @args);
-
callback
(this, 0, @args);
+
callout(
callback
, 0,
this, datarow=datarow[..<1], @args);
+
callout(
callback
, 0,
this, 0, @args);
} //! Sets up a callback for sets of rows returned from the database. //! First argument passed is the resultobject itself, second argument //! is the array of result rows (zero on EOF). //! //! @seealso //! @[fetch_row()] void set_result_array_callback( function(pgsql_result, array(array(mixed)), mixed ...:void) callback, mixed ... args) { if(callback) Thread.Thread(run_result_array_cb,callback,args); } }