Hello,
I have a problem with a function wich I am posting. First call to the function returns a single row just fine (the query is designed to fetch only ONE row). But subsequent calls return error code =100 (MYSQL_NO_DATA), even without changing the parameter to the query, which is [id_company]
void get_company_data(uint id_company) {
int r;
company.q_full.p_id_company=id_company;
if (mysql_stmt_execute(company.q_full.stmt)) {
printf("Error %u: %s\n", mysql_errno(conn), mysql_error(conn));
exit(1);
}
r=mysql_stmt_fetch(company.q_full.stmt);
if (r) {
printf("Error(%d) %u: %s\n",r, mysql_errno(conn), mysql_error(conn));
exit(1);
}
}
I use this function in a loop, but before the loop is started, I call these functions:
mysql_stmt_init
mysql_stmt_bind_param
mysql_stmt_bind_result
I do not need to call mysql_stmt_bind_param() and mysql_stmt_bind_result() every time before executing prepared statement right ?
Also I would like to ask what this phrase from the manual means:
"By default, result sets for successfully executed prepared statements are not buffered on the client ..."
What 'buffered' word means ? Does it mean the data is transferend from the server to the client? Or does it mean that my bind_result variables are filled with values?
Will appreciate any help.
Thanks