mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-07 21:00:33 +03:00
Added async read support to 'connection.poll()'.
This commit is contained in:
parent
1108172e4c
commit
6dd6bee217
|
@ -696,6 +696,29 @@ conn_poll_green(connectionObject *self)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CONN_STATUS_READY:
|
||||||
|
case CONN_STATUS_BEGIN:
|
||||||
|
Dprintf("conn_poll: status = CONN_STATUS_READY/BEGIN");
|
||||||
|
switch (self->async_status) {
|
||||||
|
case ASYNC_READ:
|
||||||
|
if (0 == PQconsumeInput(self->pgconn)) {
|
||||||
|
PyErr_SetString(OperationalError, PQerrorMessage(self->pgconn));
|
||||||
|
res = PSYCO_POLL_ERROR;
|
||||||
|
}
|
||||||
|
if (PQisBusy(self->pgconn)) {
|
||||||
|
res = PSYCO_POLL_READ;
|
||||||
|
} else {
|
||||||
|
res = PSYCO_POLL_OK;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Dprintf("conn_poll: in unexpected async status: %d",
|
||||||
|
self->async_status);
|
||||||
|
res = PSYCO_POLL_ERROR;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Dprintf("conn_poll: in unexpected state");
|
Dprintf("conn_poll: in unexpected state");
|
||||||
res = PSYCO_POLL_ERROR;
|
res = PSYCO_POLL_ERROR;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user