summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--connection.c2
-rw-r--r--connection.h2
-rw-r--r--statement.c9
3 files changed, 10 insertions, 3 deletions
diff --git a/connection.c b/connection.c
index 62e3132..5fd6b8d 100644
--- a/connection.c
+++ b/connection.c
@@ -1413,7 +1413,7 @@ void CC_on_abort(ConnectionClass *conn, UDWORD opt)
{
BOOL set_no_trans = FALSE;
-mylog("CC_on_abort in\n");
+mylog("CC_on_abort in opt=%x\n", opt);
CONNLOCK_ACQUIRE(conn);
if (0 != (opt & CONN_DEAD)) /* CONN_DEAD implies NO_TRANS also */
opt |= NO_TRANS;
diff --git a/connection.h b/connection.h
index ffa1364..d4495d3 100644
--- a/connection.h
+++ b/connection.h
@@ -87,7 +87,7 @@ enum
#define CONN_IN_ERROR_BEFORE_IDLE (1L<<3)
/* not connected yet || already disconnected */
-#define CC_not_connected(x) (CONN_DOWN == (x)->status || CONN_NOT_CONNECTED == (x)->status)
+#define CC_not_connected(x) (!(x) || CONN_DOWN == (x)->status || CONN_NOT_CONNECTED == (x)->status)
/* AutoCommit functions */
#define CC_is_in_autocommit(x) (x->transact_status & CONN_IN_AUTOCOMMIT)
diff --git a/statement.c b/statement.c
index 616c9ea..6d66a75 100644
--- a/statement.c
+++ b/statement.c
@@ -765,6 +765,11 @@ BOOL SC_opencheck(StatementClass *self, const char *func)
return TRUE;
}
}
+ if (CC_not_connected((ConnectionClass *) SC_get_conn(self)))
+ {
+ SC_set_error(self, STMT_SEQUENCE_ERROR, "the connection is closed", func);
+ return TRUE;
+ }
return FALSE;
}
@@ -1887,8 +1892,10 @@ SC_execute(StatementClass *self)
if (!res)
{
if (SC_get_errornumber(self) <= 0)
+ {
SC_set_error(self, STMT_NO_RESPONSE, "Could not receive the response, communication down ??", func);
- CC_on_abort(conn, CONN_DEAD);
+ CC_on_abort(conn, CONN_DEAD);
+ }
goto cleanup;
}
}