From 8d1c881f072049c229263c113398ae1f76545e4d Mon Sep 17 00:00:00 2001 From: vincent-zhao Date: Fri, 10 Feb 2012 14:21:43 +0800 Subject: [PATCH] Update src/mysql_bindings_connection.cc --- src/mysql_bindings_connection.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mysql_bindings_connection.cc b/src/mysql_bindings_connection.cc index 49e9f95..31cf919 100644 --- a/src/mysql_bindings_connection.cc +++ b/src/mysql_bindings_connection.cc @@ -1114,11 +1114,12 @@ void MysqlConnection::EIO_Query(eio_req *req) { pthread_mutex_lock(&conn->query_lock); int r = mysql_query(conn->_conn, query_req->query); - if (r != 0) { + int errno = mysql_errno(conn->_conn); + if (r != 0 || errno != 0) { // Query error req->result = 1; - query_req->errno = mysql_errno(conn->_conn); + query_req->errno = errno; query_req->error = mysql_error(conn->_conn); } else { req->result = 0; @@ -1142,6 +1143,8 @@ void MysqlConnection::EIO_Query(eio_req *req) { } else { // Result store error req->result = 1; + query_req->errno = errno; + query_req->error = mysql_error(conn->_conn); } } }