| CARVIEW |
The world's most popular open source database
- Documentation Library
- Table of Contents
- MySQL 6.0 Reference Manual
- MySQL 5.1 Reference Manual
- MySQL 5.0 Reference Manual
- MySQL 3.23/4.0/4.1 Manual
- Table of Contents
- 21 Connectors and APIs
- 21.1 MySQL Connector/ODBC
- 21.2 MySQL Connector/NET
- 21.3 MySQL Visual Studio Plugin
- 21.4 MySQL Connector/J
- 21.5 MySQL Connector/MXJ
- 21.6 MySQL Connector/C++
- 21.7 MySQL Connector/OpenOffice.org
- 21.8 libmysqld, the Embedded MySQL Server Library
- 21.9 MySQL C API
- 21.9.1 C API Data Types
- 21.9.2 C API Function Overview
- 21.9.3 C API Function Descriptions
- 21.9.4 C API Prepared Statements
- 21.9.5 C API Prepared Statement Data types
- 21.9.6 C API Prepared Statement Function Overview
- 21.9.7 C API Prepared Statement Function Descriptions
- 21.9.8 C API Prepared Statement Problems
- 21.9.9 C API Handling of Multiple Statement Execution
- 21.9.10 C API Handling of Date and Time Values
- 21.9.11 C API Threaded Function Descriptions
- 21.9.12 C API Embedded Server Function Descriptions
- 21.9.13 Controlling Automatic Reconnection Behavior
- 21.9.14 Common Questions and Problems When Using the C API
- 21.9.15 Building Client Programs
- 21.9.16 How to Make a Threaded Client
- 21.10 MySQL PHP API
- 21.11 MySQL Perl API
- 21.12 MySQL C++ API
- 21.13 MySQL Python API
- 21.14 MySQL Ruby APIs
- 21.15 MySQL Tcl API
- 21.16 MySQL Eiffel Wrapper
[+/-]
- 21.9.1. C API Data Types
- 21.9.2. C API Function Overview
- 21.9.3. C API Function Descriptions
- 21.9.4. C API Prepared Statements
- 21.9.5. C API Prepared Statement Data types
- 21.9.6. C API Prepared Statement Function Overview
- 21.9.7. C API Prepared Statement Function Descriptions
- 21.9.8. C API Prepared Statement Problems
- 21.9.9. C API Handling of Multiple Statement Execution
- 21.9.10. C API Handling of Date and Time Values
- 21.9.11. C API Threaded Function Descriptions
- 21.9.12. C API Embedded Server Function Descriptions
- 21.9.13. Controlling Automatic Reconnection Behavior
- 21.9.14. Common Questions and Problems When Using the C API
- 21.9.15. Building Client Programs
- 21.9.16. How to Make a Threaded Client
The C API code is distributed with MySQL. It is included in the
mysqlclient library and allows C programs to
access a database.
Many of the clients in the MySQL source distribution are written in
C. If you are looking for examples that demonstrate how to use the C
API, take a look at these clients. You can find these in the
client directory in the MySQL source
distribution.
Most of the other client APIs (all except Connector/J and
Connector/NET) use the mysqlclient library to
communicate with the MySQL server. This means that, for example, you
can take advantage of many of the same environment variables that
are used by other client programs, because they are referenced from
the library. See Chapter 4, MySQL Programs, for a list of these
variables.
The client has a maximum communication buffer size. The size of the buffer that is allocated initially (16KB) is automatically increased up to the maximum size (the maximum is 16MB). Because buffer sizes are increased only as demand warrants, simply increasing the default maximum limit does not in itself cause more resources to be used. This size check is mostly a check for erroneous statements and communication packets.
The communication buffer must be large enough to contain a single
SQL statement (for client-to-server traffic) and one row of returned
data (for server-to-client traffic). Each thread's communication
buffer is dynamically enlarged to handle any query or row up to the
maximum limit. For example, if you have
BLOB values that contain up to 16MB
of data, you must have a communication buffer limit of at least 16MB
(in both server and client). The client's default maximum is 16MB,
but the default maximum in the server is 1MB. You can increase this
by changing the value of the
max_allowed_packet parameter when
the server is started. See Section 7.5.2, “Tuning Server Parameters”.
The MySQL server shrinks each communication buffer to
net_buffer_length bytes after each
query. For clients, the size of the buffer associated with a
connection is not decreased until the connection is closed, at which
time client memory is reclaimed.
For programming with threads, see Section 21.9.16, “How to Make a Threaded Client”. For creating a standalone application which includes the "server" and "client" in the same program (and does not communicate with an external MySQL server), see Section 21.8, “libmysqld, the Embedded MySQL Server Library”.
MySQL Enterprise. MySQL Enterprise subscribers will find more information about using the C API in the Knowledge Base articles, The C API. Access to the MySQL Knowledge Base collection of articles is one of the advantages of subscribing to MySQL Enterprise. For more information, see https://www.mysql.com/products/enterprise/advisors.html.


User Comments
Connect to the Internet and do this on Debian Linux to get mysql_config and libraries for C code to compile:
apt-get install libmysqlclient15-dev
See https://packages.debian.org for place to search for missing libraries.
Add your own comment.