From fca017fde84a3d1920b5dfc13ab0b8e993a7d5dc Mon Sep 17 00:00:00 2001 From: Qiangning Hong Date: Tue, 28 Feb 2012 22:13:08 +0800 Subject: [PATCH] fix raising handshake error when no database name given, and raise reasonable exception instead of SystemError on connection error --- lib/Connection.cpp | 2 +- python/umysql.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Connection.cpp b/lib/Connection.cpp index 9e61eb9..b9fcd85 100644 --- a/lib/Connection.cpp +++ b/lib/Connection.cpp @@ -294,7 +294,7 @@ bool Connection::processHandshake() return false; } - if (!(serverCaps & MCP_CONNECT_WITH_DB) && m_database.empty()) + if ((serverCaps & MCP_CONNECT_WITH_DB) && m_database.empty()) { m_clientCaps &= ~MCP_CONNECT_WITH_DB; } diff --git a/python/umysql.c b/python/umysql.c index 4cc7d47..e895842 100644 --- a/python/umysql.c +++ b/python/umysql.c @@ -857,7 +857,7 @@ PyObject *Connection_connect(Connection *self, PyObject *args) if (!UMConnection_Connect (self->conn, host, port, username, password, database, acObj ? &autoCommit : NULL, charset)) { - return NULL; + return HandleError(self, "connect"); } Py_RETURN_NONE;