ResultSet ->getString() crashes when value is >=16

ResultSet *search;
....
....
search= prepareStatement->executeQuery();


while (search->next())
{
cout << "Email Found: " << search->getString("EmailColumn") << endl; //crashes here
}

From the code above, calling getString() function actually gets the value from the database. But then it crashes the program. It displays the value then crashes the program.

I discovered the problem but couldn’t fix it. I can’t tell if this is a bug or something else.

The problem only happens when the length of the value in the EmailColumn column is more or equals to 16. No error if the length of the value is less or equals to 15.

Any solution or workarounds for this?


Source: c++

Leave a Reply