Skip to content

Commit cbbbae2

Browse files
committed
Send meaningfull message if user tries to get result from a query that
doesn't produce result (ex: use schema).
1 parent 3c74bbb commit cbbbae2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

driver/mysql_statement.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
#include <memory>
3434
#include <algorithm>
3535
#include <sstream>
36+
#include <cstring>
37+
3638

3739
/*
3840
* mysql_util.h includes private_iface, ie libmysql headers. and they must go
@@ -133,6 +135,8 @@ MySQL_Statement::get_resultset()
133135
} catch (::sql::SQLException & e) {
134136
CPP_ERR_FMT("Error during %s_result : %d:(%s) %s", resultset_type == sql::ResultSet::TYPE_FORWARD_ONLY? "use":"store",
135137
proxy_p->errNo(), proxy_p->sqlstate().c_str(), proxy_p->error().c_str());
138+
if(e.getErrorCode() == 0 && strlen(e.what()) == 0)
139+
throw ::sql::SQLException("No result available");
136140
throw e;
137141
}
138142

0 commit comments

Comments
 (0)