Quantcast
Channel: MySQL Forums - Connector/C++
Viewing all articles
Browse latest Browse all 527

Can not use getString(), if I do code crashes (no replies)

$
0
0
Hi, guys,

I really need a help! I've been trying multiple solutions for almost a week, without any success... very frustrating.

I'm testing the use of C++/Connector (1.1.3) and everything worked fine: connection to the data base, the return of statement, etc.

But every member function whose return is a SQLString type chashes the code, even it has passed by compiler (VS 2010, and Boot included).

Detailing better: After getting a valid ptr to ResultSet (res) it's possible to output every kind of fields, except for char(fields), as shown in code parts bellow:




stmt = con->createStatement();
stmt->execute("USE test_area");
stmt->execute("DROP TABLE IF EXISTS test");
stmt->execute("CREATE TABLE test(id INT, perc DOUBLE, completo BOOL, label CHAR(5))");
for (int k=0; k<30;k++)
stmt->execute("INSERT INTO test(id, perc, completo, label) VALUES (1, .93, TRUE, 'Ajkjk')");

res = stmt->executeQuery("SELECT * FROM test LIMIT 0,10");


while (res->next())
{
cout<<"\n"<<"id = " <<res->getInt("id")<<"\tperc: "<<res->getDouble("perc")<<"\t completo : "<<res->getBoolean("completo");//no problem in this line, almost every kinds of getX()

cout<<res->getString("label");//-> But here it crashes!!!

}

PS: Hints about how to post code in inner windows are welcome.

Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>