Oracle 5.0 Reference Manual page 2175

Table of Contents

Advertisement

mysql_use_result(),
or if an error occurred.
The number of values in the row is given by mysql_num_fields(result). If
return value from a call to mysql_fetch_row(), pointers to the values are accessed as
row[mysql_num_fields(result)-1].
The lengths of the field values in the row may be obtained by calling mysql_fetch_lengths().
Empty fields and fields containing
pointer for the field value. If the pointer is NULL, the field is NULL; otherwise, the field is empty.
Return Values
A
MYSQL_ROW
occurred.
Errors
Note that error is not reset between calls to
CR_SERVER_LOST
The connection to the server was lost during the query.
CR_UNKNOWN_ERROR
An unknown error occurred.
Example
MYSQL_ROW row;
unsigned int num_fields;
unsigned int i;
num_fields = mysql_num_fields(result);
while ((row = mysql_fetch_row(result)))
{
unsigned long *lengths;
lengths = mysql_fetch_lengths(result);
for(i = 0; i < num_fields; i++)
{
printf("[%.*s] ", (int) lengths[i],
}
printf("\n");
}
20.6.6.22.
mysql_field_count()
unsigned int mysql_field_count(MYSQL *mysql)
Description
Returns the number of columns for the most recent query on the connection.
The normal use of this function is when
have no result set pointer). In this case, you can call
mysql_store_result()
to take proper action without knowing whether the query was a
The example shown here illustrates how this may be done.
See
Section 20.6.13.1, "Why
mysql_query()
C API Function Descriptions
mysql_fetch_row()
NULL
structure for the next row.
[2942]
[2941]
row[i] ? row[i] : "NULL");
should have produced a nonempty result. This enables the client program
mysql_store_result()
Returns
Success".
returns
NULL
values in the row are indicated by
NULL
both have length 0; you can distinguish these by checking the
if there are no more rows to retrieve or if an error
NULL
mysql_fetch_row()
mysql_store_result()
mysql_field_count()
Sometimes Returns
2155
when there are no more rows to retrieve
holds the
row
NULL
returned
(and thus you
NULL
to determine whether
(or SELECT-like) statement.
SELECT
After
NULL
to
row[0]
pointers.

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents