I have table like
mysql> desc account;
Code:
+----------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+--------------+------+-----+---------+-------+ | acct_num | int(11) | NO | PRI | NULL | | | amount | decimal(2,0) | YES | | NULL | | +----------+--------------+------+-----+---------+-------+
Code:
MYSQL_FIELD *fields;
unsigned int num_fields;
pResult = mysql_store_result(MySQLDB);
num_fields= mysql_num_fields(pResult);
fields = mysql_fetch_fields(pResult);
for( i = 0; i < num_fields; i++)
{
printf("Field %u is %s\n", i, fields[i].name);
}
Field
Type
NULL
KEY
Default
row = mysql_fetch_row(pResult);
it will give me output as :
acct_num
Which I wanted to get.
But other information not gettting like datatype, precision, scale, nullable.
If I fire a query select * from account;It will gives me What I want in fields.
But it is not good if the there are 100 table which has millions of records and I want information of each table.
Is ther any other way to get only the reuqired information?
