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/pqpath.h"
|
||||||
#include "psycopg/connection.h"
|
#include "psycopg/connection.h"
|
||||||
#include "psycopg/cursor.h"
|
#include "psycopg/cursor.h"
|
||||||
|
#include "psycopg/green.h"
|
||||||
#include "psycopg/typecast.h"
|
#include "psycopg/typecast.h"
|
||||||
#include "psycopg/pgtypes.h"
|
#include "psycopg/pgtypes.h"
|
||||||
#include "psycopg/pgversion.h"
|
#include "psycopg/pgversion.h"
|
||||||
|
@ -694,14 +695,23 @@ pq_execute(cursorObject *curs, const char *query, int async)
|
||||||
IFCLEARPGRES(curs->pgres);
|
IFCLEARPGRES(curs->pgres);
|
||||||
Dprintf("pq_execute: executing SYNC query:");
|
Dprintf("pq_execute: executing SYNC query:");
|
||||||
Dprintf(" %-.200s", query);
|
Dprintf(" %-.200s", query);
|
||||||
curs->pgres = PQexec(curs->conn->pgconn, 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() */
|
/* dont let pgres = NULL go to pq_fetch() */
|
||||||
if (curs->pgres == NULL) {
|
if (curs->pgres == NULL) {
|
||||||
pthread_mutex_unlock(&(curs->conn->lock));
|
pthread_mutex_unlock(&(curs->conn->lock));
|
||||||
Py_BLOCK_THREADS;
|
Py_BLOCK_THREADS;
|
||||||
PyErr_SetString(OperationalError,
|
if (!PyErr_Occurred()) {
|
||||||
PQerrorMessage(curs->conn->pgconn));
|
PyErr_SetString(OperationalError,
|
||||||
|
PQerrorMessage(curs->conn->pgconn));
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user