mysql_fetch_field_direct

頭檔案

#include<mysql.h>

函式原型

MYSQL_FIELD *mysql_fetch_field_direct(MYSQL_RES *result, unsigned int fieldnr);

說明

給定結果集內某1列的欄位編號fieldnr,以MYSQL_FIELD結構形式返回列的欄位定義。可以使用該函式檢索任意列的定義。Fieldnr的值應在從0到mysql_num_fields(result)-1的範圍內。對於指定列,返回MYSQL_FIELD結構。沒有錯誤。

範例

unsigned int num_fields;
unsigned int i;
MYSQL_FIELD *field; num_fields = mysql_num_fields(result);
for(i = 0; i < num_fields; i++){
field = mysql_fetch_field_direct(result, i);
printf("Field %u is %s\n", i, field->name);
}

相關詞條

熱門詞條

聯絡我們