Hi, I have problems calling mysql_stmt_prepare in the C-API after mysql_stmt_execute. I want to loop through a resultset by using a prepared statement. I call mysql_stmt_init, mysql_stmt_prepare and mysql_stmt_execute. Next I would loop with mysql_stmt_fetch_row. But before I would like to prepare anoter statement, which I need in my loop, but mysql tells me "Commands out of sync".
I could prepare before execute, but I wonder if I could do it in my loop. There are situations, where I might need another query in the loop depending of the data. I would like to do "lazy initialization" by delay mysql_stmt_prepare as long as possible. Here is some pseudocode: selStmt = mysql_stmt_init(); mysql_stmt_execute(selStmt); while (mysql_stmt_fetch(selStmt)) { if (some condition) { if (updStmt == NULL) { updStmt = mysql_stmt_init(); mysql_stmt_prepare(updStmt); /* <= here I get a "Commands out of sync"-error */ } mysql_stmt_execute(updStmt); } Its Mysql 4.1.13 on SuSE Linux 10.0 x86-64. Tommi -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]