mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-11 03:26:37 +03:00
'pq_execute()' uses the user wait callback if provided.
This commit is contained in:
parent
55270cab9f
commit
a7c41a0388
|
@ -40,6 +40,7 @@
|
|||
#include "psycopg/pqpath.h"
|
||||
#include "psycopg/connection.h"
|
||||
#include "psycopg/cursor.h"
|
||||
#include "psycopg/green.h"
|
||||
#include "psycopg/typecast.h"
|
||||
#include "psycopg/pgtypes.h"
|
||||
#include "psycopg/pgversion.h"
|
||||
|
@ -694,14 +695,23 @@ pq_execute(cursorObject *curs, const char *query, int async)
|
|||
IFCLEARPGRES(curs->pgres);
|
||||
Dprintf("pq_execute: executing SYNC query:");
|
||||
Dprintf(" %-.200s", query);
|
||||
if (!psyco_green()) {
|
||||
curs->pgres = PQexec(curs->conn->pgconn, query);
|
||||
}
|
||||
else {
|
||||
Py_BLOCK_THREADS;
|
||||
curs->pgres = psyco_exec_green(curs->conn, query);
|
||||
Py_UNBLOCK_THREADS;
|
||||
}
|
||||
|
||||
/* dont let pgres = NULL go to pq_fetch() */
|
||||
if (curs->pgres == NULL) {
|
||||
pthread_mutex_unlock(&(curs->conn->lock));
|
||||
Py_BLOCK_THREADS;
|
||||
if (!PyErr_Occurred()) {
|
||||
PyErr_SetString(OperationalError,
|
||||
PQerrorMessage(curs->conn->pgconn));
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user