C API Data Structures
2135
• Add the path of the directory where
libmysqlclient.so
is located to the
LD_LIBRARY_PATH
or
LD_LIBRARY
environment variable.
• On Mac OS X, add the path of the directory where
libmysqlclient.dylib
is located to the
DYLD_LIBRARY_PATH
environment variable.
• Copy the shared-library files (such as
libmysqlclient.so
) to some directory that is searched
by your system, such as
/lib
, and update the shared library information by executing
ldconfig
.
Be sure to copy all related files. A shared library might exist under several names, using symlinks to
provide the alternate names.
Another way to solve this problem is by linking your program statically with the
-static
option, or by
removing the dynamic MySQL libraries before linking your code. Before trying the second method, you
should be sure that no other programs are using the dynamic libraries.
20.6.4. C API Data Structures
This section describes C API data structures other than those used for prepared statements. For
information about the latter, see
Section 20.6.8, “C API Prepared Statement Data Structures”
.
•
MYSQL
This structure represents a handle to one database connection. It is used for almost all MySQL
functions. Do not try to make a copy of a
MYSQL
structure. There is no guarantee that such a copy is
usable.
•
MYSQL_RES
This structure represents the result of a query that returns rows (
SELECT
,
SHOW
,
DESCRIBE
,
EXPLAIN
). The information returned from a query is called the result set in the remainder of this
section.
•
MYSQL_ROW
This is a type-safe representation of one row of data. It is currently implemented as an array of
counted byte strings. (You cannot treat these as null-terminated strings if field values may contain
binary data, because such values may contain null bytes internally.) Rows are obtained by calling
mysql_fetch_row()
.
•
MYSQL_FIELD
This structure contains metadata: information about a field, such as the field's name, type, and size.
Its members are described in more detail later in this section. You may obtain the
MYSQL_FIELD
structures for each field by calling
mysql_fetch_field()
repeatedly. Field values are not part of
this structure; they are contained in a
MYSQL_ROW
structure.
•
MYSQL_FIELD_OFFSET
This is a type-safe representation of an offset into a MySQL field list. (Used by
mysql_field_seek()
.) Offsets are field numbers within a row, beginning at zero.
•
my_ulonglong
The type used for the number of rows and for
mysql_affected_rows()
,
mysql_num_rows()
,
and
mysql_insert_id()
. This type provides a range of
0
to
1.84e19
.
On some systems, attempting to print a value of type
my_ulonglong
does not work. To print such a
value, convert it to
unsigned long
and use a
%lu
print format. Example:
printf ("Number of rows: %lu\n",
(unsigned long) mysql_num_rows(result));
•
my_bool
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...