Oracle 5.0 Reference Manual page 2176

Table of Contents

Advertisement

Return Values
An unsigned integer representing the number of columns in a result set.
Errors
None.
Example
MYSQL_RES *result;
unsigned int num_fields;
unsigned int num_rows;
if (mysql_query(&mysql,query_string))
{
// error
}
else // query succeeded, process any data returned by it
{
result = mysql_store_result(&mysql);
if (result)
{
num_fields = mysql_num_fields(result);
// retrieve rows, then call mysql_free_result(result)
}
else
// mysql_store_result() returned nothing; should it have?
{
if(mysql_field_count(&mysql) == 0)
{
}
else // mysql_store_result() should have returned data
{
}
}
}
An alternative is to replace the
In this case, you are checking directly for an error from
from the value of
20.6.6.23.
mysql_field_seek()
MYSQL_FIELD_OFFSET mysql_field_seek(MYSQL_RES *result, MYSQL_FIELD_OFFSET
offset)
Description
Sets the field cursor to the given offset. The next call to
definition of the column associated with that offset.
To seek to the beginning of a row, pass an
Return Values
The previous value of the field cursor.
Errors
None.
20.6.6.24.
mysql_field_tell()
C API Function Descriptions
// there are rows
// query does not return data
// (it was not a SELECT)
num_rows = mysql_affected_rows(&mysql);
fprintf(stderr, "Error: %s\n", mysql_error(&mysql));
mysql_field_count(&mysql)
mysql_field_count()
call with mysql_errno(&mysql).
mysql_store_result()
whether the statement was a SELECT.
mysql_fetch_field()
value of zero.
offset
2156
rather than inferring
retrieves the field

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents