summaryrefslogtreecommitdiff
path: root/psycopg/connection_int.c
diff options
context:
space:
mode:
authorFederico Di Gregorio <fog@initd.org>2007-09-08 08:54:30 +0000
committerFederico Di Gregorio <fog@initd.org>2007-09-08 08:54:30 +0000
commitc9e701baa972f9ea104134b9a7e971be80f84d1f (patch)
treee3f28cfa720e9911e2237789aeb75f287bb53e65 /psycopg/connection_int.c
parent0422506404cc34ba2dd986b5dd11ea63f7f52c72 (diff)
downloadpsycopg2-c9e701baa972f9ea104134b9a7e971be80f84d1f.tar.gz
Fixed bug #194 (and added nice MD project not that C/C++ is supported.)
Diffstat (limited to 'psycopg/connection_int.c')
-rw-r--r--psycopg/connection_int.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/psycopg/connection_int.c b/psycopg/connection_int.c
index be53472..6995451 100644
--- a/psycopg/connection_int.c
+++ b/psycopg/connection_int.c
@@ -40,8 +40,10 @@ conn_notice_callback(void *args, const char *message)
Dprintf("conn_notice_callback: %s", message);
/* unfortunately the old protocl return COPY FROM errors only as notices,
- so we need to filter them looking for such errors */
- if (strncmp(message, "ERROR", 5) == 0)
+ so we need to filter them looking for such errors (but we do it
+ only if the protocol if <3, else we don't need that */
+
+ if (self->protocol < 3 && strncmp(message, "ERROR", 5) == 0)
pq_set_critical(self, message);
else
PyList_Append(self->notice_list, PyString_FromString(message));
@@ -208,6 +210,8 @@ conn_commit(connectionObject *self)
pthread_mutex_unlock(&self->lock);
Py_END_ALLOW_THREADS;
+ if (res == -1)
+ pq_resolve_critical(self, 0);
return res;
}
@@ -227,6 +231,8 @@ conn_rollback(connectionObject *self)
pthread_mutex_unlock(&self->lock);
Py_END_ALLOW_THREADS;
+ if (res == -1)
+ pq_resolve_critical(self, 0);
return res;
}