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:743:
timeout = _timeout; syncparse = _syncparse; gottimeout = _pgsqlsess->cancelquery; c->runningportals[this] = 1; transtype = _transtype; } //! Returns the command-complete status for this query. //! //! @note
-
//! This method should normally be called after EOF has been reached.
-
//! If it is called before, all unfetched result rows will be discarded.
-
//!
-
//! @note
+
//! This function is PostgreSQL-specific. //!
-
//! @[affected_rows()]
, @[eof()]
+
//!
@seealso
+
//!
@[affected_rows()]
/*semi*/final string status_command_complete() {
-
+
if (!statuscmdcomplete) {
+
if (!datarowtypes)
+
waitfordescribe();
+
{
+
Thread.MutexKey lock = closemux->lock();
+
if (_fetchlimit)
+
_sendexecute(_fetchlimit = 0);
+
lock = _ddescribemux->lock();
if (!statuscmdcomplete)
-
while
(
fetch
_
row_array
());
+
PT
(_
ddescribe->wait
(
lock
));
+
}
+
if (this) // If object already destructed, skip the next call
+
trydelayederror(); // since you cannot call functions anymore
+
else
+
error(LOSTERROR);
+
}
return statuscmdcomplete; } //! Returns the number of affected rows by this query. //! //! @note
-
//! This method should normally be called after EOF has been reached.
-
//! If it is called before, all unfetched result rows will be discarded.
-
//!
-
//! @note
+
//! This function is PostgreSQL-specific. //! //! @seealso
-
//! @[
status
_
command_complete
()], @[
eof
()]
+
//! @[
num
_
rows
()], @[
status_command_complete
()]
/*semi*/final int affected_rows() { int rows;
-
sscanf(status_command_complete(), "%*s %d %d", rows, rows);
+
sscanf(status_command_complete()
|| ""
, "%*s %d %d", rows, rows);
return rows; } final void _storetiming() { if (_tprepared) { _tprepared.trun = gethrtime() - _tprepared.trunstart; m_delete(_tprepared, "trunstart"); _tprepared = 0; } }
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:1373:
datarowtypes = emptyarray; _ddescribe->broadcast(); } if (delayederror && !pgsqlsess.delayederror) pgsqlsess.delayederror = delayederror; // Preserve error upstream pgsqlsess = 0; } final void _releasesession(void|string statusccomplete) { c->runningportals[this] = 0;
-
if (statusccomplete && !statuscmdcomplete)
+
if (statusccomplete && !statuscmdcomplete)
{
+
Thread.MutexKey lock = _ddescribemux->lock();
statuscmdcomplete = statusccomplete;
-
+
_ddescribe->broadcast();
+
}
inflight = 0; conxsess plugbuffer; if (!catch(plugbuffer = c->start())) plugbuffer->sendcmd(_closeportal(plugbuffer)); if (_state < CLOSED) _state = CLOSED; datarows->write(1); // Signal EOF releaseconditions(); }
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:2451:
delayederror = err; } destruct(waitforauthready); c->purge(); }; } final void close() { throwdelayederror(this); {
-
Thread.MutexKey lock
;
-
while (qportals && qportals
->
size
()
)
-
sleep
(
0.1, 1
);
// Drain portal queue to completion
+
Thread.MutexKey lock
=
shortmux
->
lock
()
;
+
portalsinflight->wait_till_drained
(
lock
);
//
Drain
portal
queue
to
completion
+
lock
=
0;
if (unnamedstatement) termlock = unnamedstatement->lock(1); if (c) // Prevent trivial backtraces c->close(); if (unnamedstatement) lock = unnamedstatement->lock(1); if (c) c->purge(); } destruct(waitforauthready);