mysqlpp returning a string.
im trying to get a string by using:
mysql::execute("SELECT name FROM test WHERE id = '3'");
But i dont know how :S
heres the code behind "mysql::execute"
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
mysqlpp::StoreQueryResult mysql::execute(string queryString)
{
mysqlpp::Query ptr = NULL;
static mysqlpp::StoreQueryResult res;
try
{
if(!mysql::conn->ping())
{
//Reconnect
mysql::connect();
}
//Attempt to execute it
ptr = mysql::conn->query(queryString);
if(res = ptr.store())
{
return res;
}
else
{
/*server::print(string(ptr.error()), game::c_lightred);//Prblem
server::print(string(queryString), game::c_lightred);
system("PAUSE"); THIS IS ONLY CAUSING MORE ERRORS!
exit(0);*/
return res;
}
return res;
}
catch(const mysqlpp::BadQuery&)
{
//Error occured when executing query
server::print(string(ptr.error()), game::c_lightred);
server::print(string(queryString), game::c_lightred);
system("PAUSE");
exit(0);
return res;
}
}
|
How do i get the string from mysql using that code :)
Topic archived. No new replies allowed.