the following code generates error
std::string xyz="whatever"; int x=1; xyz+=std::to_string(x); //this is supposed to turn xyz into whatever1 from whatever
Why am I using this approach? Because prepared statements are not working with the version of mysql on my ubuntu(there's a bug with this mysql version), and I have tried and followed everything to upgrade the mysql, but Alas! So, where I was supposed to do this
sql::preparedStatement* pstm=con->prepare_Statement("select x from y where a=?"); pstm->setString(1,"xyz");
I am getting a segmentation fault, core dump error in above. It's a common bug with the version of mySQL that I have in UBUNTU.After trying all I could to upgrade mysql, I have decided to not use prepared statements at all. Instead i decided to make queries like
std::string query="select x from y where a="; int x=5; query+=std::to_string(x);
And KUDOS! The g++ version doesn't support C++11 features, and thus to_string is not a part of std. I've tried the following commands
sudo apt-get update sudo apt-get upgrade g++
No luck, yet. Any help will be highly appreciated
PS, for the time being, I am using this approach to concatenate integers with string
sstream ss; ss
But, I don't want to just keep switching ways just because I can not update a bloody feature of Ubuntu, nobody wants that. Right?