mysql - PreparedStatement and Array in c++ -
this how define array
const int maxmatch = 10; string a[maxmatch] = {"g111", "g112", "g113"};
with code below intend use array in query
con->setclientoption("libmysql_debug", "d:t:o,/tmp/mysql.trace"); string a[maxmatch] = {"g111", "g112", "g113"}; pstmt = con->preparestatement("select lenght rods name = ? "); (int = 0; < maxmatch; i++) { string lastmatch = a[i]; pstmt->setstring(1, lastmatch); res = pstmt->executequery(); con->setclientoption("client_trace", &on_off); res->afterlast(); while (res->previous()) cout << "\t... lenght ...: " << res->getint("lenght") << endl; delete res; }
the code compiles, not result. there must wrong passing array setstring, not understand problem is.
Comments
Post a Comment