Fix the example overload pb on GCC & Clang

- uses explicit getText() instead of implicit conversion
This commit is contained in:
Sébastien Rombauts 2015-04-29 10:19:19 +02:00
parent 6a2f8a6a8b
commit d45ec996a3

View File

@ -123,11 +123,11 @@ int main ()
std::cout << "origin table 'test' [\"" << oname0.c_str() << "\", \"" << oname1.c_str() << "\", \"" << oname2.c_str() << "\"]\n"; std::cout << "origin table 'test' [\"" << oname0.c_str() << "\", \"" << oname1.c_str() << "\", \"" << oname2.c_str() << "\"]\n";
#endif #endif
// Demonstrates how to get some typed column value (and the equivalent explicit call) // Demonstrates how to get some typed column value (and the equivalent explicit call)
const int id = query.getColumn(0); // = query.getColumn(0).getInt() const int id = query.getColumn(0); // = query.getColumn(0).getInt();
//const char* pvalue = query.getColumn(1); // = query.getColumn(1).getText() //const char* pvalue = query.getColumn(1); // = query.getColumn(1).getText();
const std::string value2 = query.getColumn(1); // = query.getColumn(1).getText() const std::string value2 = query.getColumn(1); // = query.getColumn(1).getText();
const int bytes = query.getColumn(1).getBytes(); const int bytes = query.getColumn(1).getBytes();
const double weight = query.getColumn(2); // = query.getColumn(2).getInt() const double weight = query.getColumn(2); // = query.getColumn(2).getInt();
std::cout << "row (" << id << ", \"" << value2.c_str() << "\" " << bytes << " bytes, " << weight << ")\n"; std::cout << "row (" << id << ", \"" << value2.c_str() << "\" " << bytes << " bytes, " << weight << ")\n";
} }
@ -151,9 +151,9 @@ int main ()
double weight = 0.0; double weight = 0.0;
while (query.executeStep()) while (query.executeStep())
{ {
id = query.getColumn(0); // = query.getColumn(0).getInt() id = query.getColumn(0).getInt();
value2 = query.getColumn(1); // = query.getColumn(1).getText() value2 = query.getColumn(1).getText();
weight = query.getColumn(2); // = query.getColumn(1).getInt() weight = query.getColumn(2).getInt();
std::cout << "row (" << id << ", \"" << value2 << "\", " << weight << ")\n"; std::cout << "row (" << id << ", \"" << value2 << "\", " << weight << ")\n";
} }
} }