Bug #72017 getString() crashes the program in Visual Studio 2013
Submitted: 12 Mar 2014 4:56 Modified: 20 Feb 2015 12:37
Reporter: David Bishop Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / C++ Severity:S3 (Non-critical)
Version:1.1.3 OS:Windows (Windows 7 64 bit)
Assigned to: Assigned Account CPU Architecture:Any

[12 Mar 2014 4:56] David Bishop
Description:
I see several posts about getString() causing a crash.   I don't see any real resolution since the authors of the posts stop responding.
I am running MySql on Windows 7, 64 bit version.

The build environment is Visual Studio 2013. 
I do not see any notes on building with this version.   I did not use Cmake to build any libs or dll's.   I used the MSI installer to obtain all the binary files to link against.     
I build the C++ connector (ver 1.1.3 latest as of March 2014) as a 64 bit release version.   I have not built debug yet.

All the code compiles cleanly and I can access the SQL DB.  Logging in works, insertions work and I think everything works except for the getString() function.

Is it advised to rebuild everything from scratch?   

How to repeat:
Can the problem be with using Visual Studio 2013?
[12 Mar 2014 11:03] MySQL Verification Team
Thank you for the bug report. Please provide the code test case. Thanks.
[12 Mar 2014 15:50] David Bishop
Source code from link to the dev.mysql.com area

Attachment: cpp_example.cpp (text/plain), 8.80 KiB.

[12 Mar 2014 16:03] David Bishop
the source code is from your tech-resources area.
http://dev.mysql.com/tech-resources/articles/mysql-connector-cpp.html

the failures are in any attempt to use getString().   getString(int) or getString("aname") cause the code to crash.

In the method named: retrieve_dbmetadata_and_print()
retrieval of the meta data causes a crash and the getUserName() actually prints most of the password at the crash.

In the method named: retrieve_rsmetadata_and_print()
There is no crash.   getColumnCount() returns the correct value.
I do not see any return from:
getColumnLabel(), getTableName() or getSchemaName()

The code does add the correct items to the "city" table and setSavepoint, setString(), rollback() appear to work. 
MySQL Workbench confirms the table is getting populated correctly.
[20 Jan 2015 12:37] Hemant Dangi
This could be due to string being destroyed on a different heap than it was created on.
To resolve use same VS10 runtime and same connection option flag (multi thread dll) as used by Connector/C++ binaries. Or download source and compile yourself on VS2013 as we are not providing binaries  compiled with VS2013 yet.
[21 Feb 2015 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".