Bug #69904 setInt of preparestatement NOT functioned
Submitted: 1 Aug 2013 22:12 Modified: 4 Aug 2013 18:42
Reporter: Yan Yan Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / C++ Severity:S2 (Serious)
Version:1.1.3 OS:Windows (Win7 64bit)
Assigned to: CPU Architecture:Any
Tags: preparestatement problem

[1 Aug 2013 22:12] Yan Yan
Description:

I have donwloaded "MySQL Connector C++ 1.1.3" and run sample "MySQL Connector/C++ Complete Example 2" (http://dev.mysql.com/doc/refman/5.6/en/connector-cpp-examples-complete-example-2.html), and have meet a serious problem. 

pstmt = con->prepareStatement("INSERT INTO test(id) VALUES (?)");
for (int i = 1; i <= 10; i++) {
   pstmt->setInt(1, i);               //---- NOT functioned!
   int nbr = pstmt->executeUpdate();  //---- return 1, means successfully.
}

The "test" table becomes to "0,0,...,0", not expected "1,2,...,10). From my diagnosis, it is "setInt()" not functioned. How to locate and solve this problem? Thanks very much.

How to repeat:
http://dev.mysql.com/doc/refman/5.6/en/connector-cpp-examples-complete-example-2.html

Just run this sample of above, and it could repeat on my environment every time. The "test" table becomes to "0,0,...,0", not expected "1,2,...,10). 

Win7 64bit;
Visual Studio 2008;
xampp installed (with mysql 5.5.32);
MySQL Connector C++ 1.1.3;
Boost 1.54.
[4 Aug 2013 18:42] MySQL Verification Team
I couldn't repeat:

c:\tmp\bugtest\x64\Release>bugtest.exe

Let's have MySQL count from 10 to 1...
        ... MySQL counts: 10
        ... MySQL counts: 9
        ... MySQL counts: 8
        ... MySQL counts: 7
        ... MySQL counts: 6
        ... MySQL counts: 5
        ... MySQL counts: 4
        ... MySQL counts: 3
        ... MySQL counts: 2
        ... MySQL counts: 1

c:\tmp\bugtest\x64\Release>