0
看到下面的代碼:
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/,好吧,任何人有任何想法?
我的歉意... – capede 2011-02-27 10:35:08