Bug #92263 Crash in Connector C++
Submitted: 31 Aug 2018 19:14 Modified: 3 Dec 16:51
Reporter: Ivo Grzanowski Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / C++ Severity:S2 (Serious)
Version:8.0.12 OS:Microsoft Windows (7.0)
Assigned to: CPU Architecture:x86 (Core i7)

[31 Aug 2018 19:14] Ivo Grzanowski
Description:
Following problems:

1. MySQL_connect->createStatement();
   myqlResult = MySQL_statement->executeQuery("USE <database>");
---> it crashes without any useful exception.
I know, there is a function called "

(preparedStatement does it better, fills after all the exception structure...) 

2. Why does the C++ interface only support the char* ? (sql::String)
   Every Apps use multiple languages (wchar_t) today. The database (8.x) supports           wchars.

How to repeat:
MySQL_statement = MySQL_connect->createStatement();
myqlResult = MySQL_statement->executeQuery("USE xyz");//fails without any error
(exception  e is empty)

MySQL_prepdStatement = MySQL_connect->prepareStatement("USE xyz");
if (MySQL_prepdStatement)
  MySQL_resultSet = MySQL_prepdStatement->executeQuery();
//ends with error and a filles the exception structure

Suggested fix:
[3 Sep 2018 13:40] Umesh Shastry
Hello Ivo Grzanowski,

Thank you for the report.

regards,
Umesh
[2 Dec 14:38] Luis Silva
Posted by developer:
 
There is no error... thing is, it throws exception because "use <database>" doesn't produce a result.
And it crashes because main() is not catching exceptions.

Fixed: Better error description if user tries to get result from a query which doesn't produce one.
[3 Dec 16:51] Paul Dubois
Posted by developer:
 
Fixed in 8.0.19.

If an application tries to obtain a result set from a statement that
does not produce one, an exception occurs. For applications that do
not catch such exceptions, Connector/C++ now produces a more
informative error message to indicate why the exception occurred.