Hi I want to get some strings from my SQL database. So I did a search for the wanted entries and after a quick check of how many he found it seems that he successfully did the search.
but now I have the problem with getting the wanted values from the searched entries (its a String).
I would have thought that the proper method for this would be getString(x) where x is either the desire Columnindexnumber or directly the title of the column.
However he crashes everytime I want to use this function. He throws the Exception "sql::InvalidArgumentException" which I cant really understand why because the indexnumber or indexname should be right.
Or did I understand something wrong?
Anyway here's the code:
sql::ResultSet* result = fw->database->Query("SELECT `email` FROM `users` WHERE `id`='%i'", user_id)
int rows = result->rowsCount(); // he should find 3 entries and after calling rowsCount(), rows contains indeed the value 3
int n = result->getMetaData()->getColumnCount(); // contains the value 1 afterwards (because I only select one column, namely "email" ?)
// I tested every single of these parameters just to be sure but I get everytime the exception
result->getString(0);
result->getString(1);
result->getString("email");
result->getString("`email`");
but now I have the problem with getting the wanted values from the searched entries (its a String).
I would have thought that the proper method for this would be getString(x) where x is either the desire Columnindexnumber or directly the title of the column.
However he crashes everytime I want to use this function. He throws the Exception "sql::InvalidArgumentException" which I cant really understand why because the indexnumber or indexname should be right.
Or did I understand something wrong?
Anyway here's the code:
sql::ResultSet* result = fw->database->Query("SELECT `email` FROM `users` WHERE `id`='%i'", user_id)
int rows = result->rowsCount(); // he should find 3 entries and after calling rowsCount(), rows contains indeed the value 3
int n = result->getMetaData()->getColumnCount(); // contains the value 1 afterwards (because I only select one column, namely "email" ?)
// I tested every single of these parameters just to be sure but I get everytime the exception
result->getString(0);
result->getString(1);
result->getString("email");
result->getString("`email`");