#include int main(int argc, char *argv[]) { mysqlpp::Connection conn("db", "localhost", "user", "pass"); mysqlpp::Query query = conn.query("SELECT * FROM image"); mysqlpp::UseQueryResult res = query.use(); int n = 0; while(mysqlpp::Row row = res.fetch_row()) { if(n % 10000 == 0) { printf("Row %d\n", n); } /* Run this program 3 times: * * 1) without this line, to check if the query runs fine * 2) with this line, to trigger the bug * 3) without this line again, to see the symptoms of the bug. */ if(n == 100) _exit(0); n++; } return 0; }