люди
см. Следующий код:
gboolean auto_refresh_host_list(bahan *unit)
{
//assuming unit->setting->handle_conn has initiated and connected
mysql_query(unit->setting->handle_conn,"select * from host");
unit->setting->handle_result = mysql_store_result(unit->setting->handle_conn);
guint num_fields = mysql_num_fields(unit->setting->handle_result);
line:148 while((unit->setting->handle_row = mysql_fetch_row(unit->setting->handle_result)))
{
guint i;
for(i=0; i<= num_fields; i++)
{
line:153 printf("%s", (unit->setting->handle_row[i] ? unit->setting->handle_row[i] : "NULL" ));
}
printf("\n");
}
mysql_free_result(unit->setting->handle_result);
line:158}
но как только я его скомпилирую, выведите предупреждение вот так:
main.c:148: warning: assignment from incompatible pointer type
main.c:153: warning: pointer type mismatch in conditional expression
main.c:153: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘void * const’
main.c:158: warning: control reaches end of non-void function
в любом случае структура должна выглядеть следующим образом:
MYSQL *handle_conn;
MYSQL_RES *handle_result;
MYSQL_ROW *handle_row;
MYSQL_FIELD *handle_field;
я немного растерялся после прочтения http://zetcode.com/tutorials/mysqlcapitutorial/, ну, у кого есть идеи?