Poco & Mysql: select execute

Please post support and help requests here.
nerik
Posts: 1
Joined: 09 Nov 2017, 18:36

Poco & Mysql: select execute

Postby nerik » 09 Nov 2017, 18:52

Hi. Sorry for my bad English :)
Use poco 1.7.9 with mysql and code:

Code: Select all

Poco::Data::MySQL::Connector::registerConnector();
try {
 int id;
 std::string name;
 Poco::Data::Session session(Poco::Data::MySQL::Connector::KEY,"host=localhost;user=user;password=test;db=dbname;auto-reconnect=true");
 Poco::Data::Statement stm(session);
 stm << "select `id`,`name` from `users`", Poco::Data::Keywords::into(id),Poco::Data::Keywords::into(name),Poco::Data::Keywords::range(0,1);
 while (!stm.done()) {
  std::cout << "row: " << std::endl;
  stm.execute();
  std::cout << "  " << id << ":" << name << std::endl;
 }
}
catch (const Poco::Data::MySQL::StatementException &se) {
 std::cout << "  error stm" << std::endl;
}
catch (const Poco::Data::ConnectionFailedException &ce) {
 std::cout << "  error connect" << std::endl;
}


I run the program and see only the word "row". Hangs on team "stm.execute()".
Please, i need help.

Return to “Support”

Who is online

Users browsing this forum: No registered users and 4 guests

cron