Oracle 5.0 Reference Manual page 2174

Table of Contents

Advertisement

Example
unsigned int num_fields;
unsigned int i;
MYSQL_FIELD *fields;
num_fields = mysql_num_fields(result);
fields = mysql_fetch_fields(result);
for(i = 0; i < num_fields; i++)
{
printf("Field %u is %s\n", i, fields[i].name);
}
20.6.6.20.
mysql_fetch_lengths()
unsigned long *mysql_fetch_lengths(MYSQL_RES *result)
Description
Returns the lengths of the columns of the current row within a result set. If you plan to copy field
values, this length information is also useful for optimization, because you can avoid calling strlen().
In addition, if the result set contains binary data, you must use this function to determine the size of the
data, because
The length for empty columns and for columns containing
distinguish these two cases, see the description for mysql_fetch_row().
Return Values
An array of unsigned long integers representing the size of each column (not including any terminating
null characters).
Errors
mysql_fetch_lengths()
it before calling
Example
MYSQL_ROW row;
unsigned long *lengths;
unsigned int num_fields;
unsigned int i;
row = mysql_fetch_row(result);
if (row)
{
num_fields = mysql_num_fields(result);
lengths = mysql_fetch_lengths(result);
for(i = 0; i < num_fields; i++)
{
printf("Column %u is %lu bytes in length.\n",
}
}
20.6.6.21.
mysql_fetch_row()
MYSQL_ROW mysql_fetch_row(MYSQL_RES *result)
Description
Retrieves the next row of a result set. When used after mysql_store_result(),
mysql_fetch_row()
C API Function Descriptions
returns incorrect results for any field containing null characters.
strlen()
if an error occurred.
NULL
is valid only for the current row of the result set. It returns
mysql_fetch_row()
i, lengths[i]);
returns
NULL
NULL
or after retrieving all rows in the result.
when there are no more rows to retrieve. When used after
2154
values is zero. To see how to
if you call
NULL

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents