MySQL Forums
Forum List  »  Connector/C++

Can not use getString(), if I do code crashes
Posted by: Aluísio Macedo
Date: August 12, 2013 04:15PM

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.

Aluísio Macedo
São Paulo/Brasil



Edited 3 time(s). Last edit at 08/12/2013 04:37PM by Aluísio Macedo.

Options: ReplyQuote


Subject
Views
Written By
Posted
Can not use getString(), if I do code crashes
2725
August 12, 2013 04:15PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.