summaryrefslogtreecommitdiff
path: root/psycopg/connection.h
diff options
context:
space:
mode:
Diffstat (limited to 'psycopg/connection.h')
-rw-r--r--psycopg/connection.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/psycopg/connection.h b/psycopg/connection.h
index 262e6ac..979b37f 100644
--- a/psycopg/connection.h
+++ b/psycopg/connection.h
@@ -136,6 +136,8 @@ HIDDEN int conn_connect(connectionObject *self, long int async);
HIDDEN void conn_close(connectionObject *self);
HIDDEN int conn_commit(connectionObject *self);
HIDDEN int conn_rollback(connectionObject *self);
+HIDDEN int conn_set(connectionObject *self, const char *param, const char *value);
+HIDDEN int conn_set_autocommit(connectionObject *self, int value);
HIDDEN int conn_switch_isolation_level(connectionObject *self, int level);
HIDDEN int conn_set_client_encoding(connectionObject *self, const char *enc);
HIDDEN int conn_poll(connectionObject *self);
@@ -154,6 +156,13 @@ HIDDEN PyObject *conn_tpc_recover(connectionObject *self);
"in asynchronous mode"); \
return NULL; }
+#define EXC_IF_IN_TRANSACTION(self, cmd) \
+ if (self->status != CONN_STATUS_READY) { \
+ PyErr_Format(ProgrammingError, \
+ "%s cannot be used inside a transaction", #cmd); \
+ return NULL; \
+ }
+
#define EXC_IF_TPC_NOT_SUPPORTED(self) \
if ((self)->server_version < 80100) { \
PyErr_Format(NotSupportedError, \