Is it possible to get MYSQL_ROW when using mysql prepared statements? We are replacing legacy code by mysql prepared statements in C. However, due to the way mysql prepared statements returns result, the task has become huge.
The old code was using MYSQL_RES and MYSQL_ROW
MYSQL_ROW row = mysql_fetch_row(res);
while prepared statements requires us to bind each variable
mysql_stmt_bind_result(stmt, bind);
mysql_stmt_fetch(stmt);
I was unable to find any stmt API that returns ROW which is surprising. Have I overlooked something obvious?
If not, I plan to explore MYSQL_STMT structure which has some resemble to MYSQL_RES, especially the data_cursor variable.
typedef struct MYSQL_STMT {
struct MEM_ROOT *mem_root; /* root allocations */
LIST list; /* list to keep track of all stmts */
MYSQL *mysql; /* connection handle */
MYSQL_BIND *params; /* input parameters */
MYSQL_BIND *bind; /* output parameters */
MYSQL_FIELD *fields; /* result set metadata */
MYSQL_DATA result; /* cached result set */
MYSQL_ROWS *data_cursor; /* current row in cached result */
Any suggestions?
Thank a ton for your help.