mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 17:06:33 +03:00
Dropped large object support when psycopg is in green mode.
Async mode and large object are not compatible, albeit I haven't found an authoritative source yet.
This commit is contained in:
parent
2596cf7125
commit
e29424a230
|
@ -435,6 +435,9 @@ callback (using `!select()` to block) is provided as
|
|||
:ref:`COPY commands <copy>` are currently not supported when a wait callback
|
||||
is registered, but they will be probably implemented in a future release.
|
||||
|
||||
:ref:`Large objects <large-objects>` are not supported either: they are
|
||||
not compatible with asynchronous connections.
|
||||
|
||||
|
||||
.. testcode::
|
||||
:hide:
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "psycopg/cursor.h"
|
||||
#include "psycopg/pqpath.h"
|
||||
#include "psycopg/lobject.h"
|
||||
#include "psycopg/green.h"
|
||||
|
||||
/** DBAPI methods **/
|
||||
|
||||
|
@ -314,6 +315,7 @@ psyco_conn_lobject(connectionObject *self, PyObject *args, PyObject *keywds)
|
|||
|
||||
EXC_IF_CONN_CLOSED(self);
|
||||
EXC_IF_CONN_ASYNC(self, lobject);
|
||||
EXC_IF_GREEN(lobject);
|
||||
|
||||
Dprintf("psyco_conn_lobject: new lobject for connection at %p", self);
|
||||
Dprintf("psyco_conn_lobject: parameters: oid = %d, mode = %s",
|
||||
|
|
|
@ -113,12 +113,6 @@ if ((self)->conn->async_cursor != NULL) { \
|
|||
"while an asynchronous query is underway"); \
|
||||
return NULL; }
|
||||
|
||||
#define EXC_IF_GREEN(cmd) \
|
||||
if (psyco_green()) { \
|
||||
PyErr_SetString(PyExc_NotImplementedError, #cmd " cannot be used " \
|
||||
"with an asynchronous callback (yet)."); \
|
||||
return NULL; }
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -62,6 +62,12 @@ HIDDEN int psyco_green(void);
|
|||
HIDDEN int psyco_wait(connectionObject *conn);
|
||||
HIDDEN PGresult *psyco_exec_green(connectionObject *conn, const char *command);
|
||||
|
||||
#define EXC_IF_GREEN(cmd) \
|
||||
if (psyco_green()) { \
|
||||
PyErr_SetString(ProgrammingError, #cmd " cannot be used " \
|
||||
"with an asynchronous callback."); \
|
||||
return NULL; }
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -50,13 +50,13 @@ def test_suite():
|
|||
suite.addTest(test_transaction.test_suite())
|
||||
suite.addTest(types_basic.test_suite())
|
||||
suite.addTest(types_extras.test_suite())
|
||||
suite.addTest(test_lobject.test_suite())
|
||||
|
||||
if not green:
|
||||
suite.addTest(test_lobject.test_suite())
|
||||
suite.addTest(test_copy.test_suite())
|
||||
else:
|
||||
import warnings
|
||||
warnings.warn("copy not implemented in green mode: skipping tests")
|
||||
warnings.warn("copy/lobjects not implemented in green mode: skipping tests")
|
||||
|
||||
suite.addTest(test_notify.test_suite())
|
||||
suite.addTest(test_async.test_suite())
|
||||
|
|
Loading…
Reference in New Issue
Block a user