Rechercher dans le manuel MySQL
28.7 MySQL C API
[+/-]
- 28.7.1 MySQL C API Implementations
- 28.7.2 Simultaneous MySQL Server and Connector/C Installations
- 28.7.3 Example C API Client Programs
- 28.7.4 Building and Running C API Client Programs
- 28.7.5 C API Data Structures
- 28.7.6 C API Function Overview
- 28.7.7 C API Function Descriptions
- 28.7.8 C API Prepared Statements
- 28.7.9 C API Prepared Statement Data Structures
- 28.7.10 C API Prepared Statement Function Overview
- 28.7.11 C API Prepared Statement Function Descriptions
- 28.7.12 C API Asynchronous Interface
- 28.7.13 C API Asynchronous Interface Data Structures
- 28.7.14 C API Asynchronous Function Overview
- 28.7.15 C API Asynchronous Function Descriptions
- 28.7.16 C API Threaded Function Descriptions
- 28.7.17 C API Client Plugin Functions
- 28.7.18 C API Binary Log Interface
- 28.7.19 C API Binary Log Data Structures
- 28.7.20 C API Binary Log Function Overview
- 28.7.21 C API Binary Log Function Descriptions
- 28.7.22 C API Encrypted Connection Support
- 28.7.23 C API Multiple Statement Execution Support
- 28.7.24 C API Prepared Statement Handling of Date and Time Values
- 28.7.25 C API Prepared CALL Statement Support
- 28.7.26 C API Prepared Statement Problems
- 28.7.27 C API Optional Result Set Metadata
- 28.7.28 C API Automatic Reconnection Control
- 28.7.29 C API Common Issues
The C API provides low-level access to the MySQL client/server
protocol and enables C programs to access database contents. The C
API code is distributed with MySQL and implemented in the
libmysqlclient
library. See
Section 28.7.1, “MySQL C API Implementations”.
Most other client APIs use the libmysqlclient
library to communicate with the MySQL server. (Exceptions are
Connector/J and Connector/NET.) 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.
For a list of these variables, see
Section 4.1, “Overview of MySQL Programs”.
For instructions on building client programs using the C API, see Section 28.7.4.1, “Building C API Client Programs”. For programming with threads, see Section 28.7.4.3, “Writing C API Threaded Client Programs”.
If, after an upgrade, you experience problems with compiled client
programs, such as Commands out of sync
or
unexpected core dumps, the programs were probably compiled using
old header or library files. In this case, check the date of the
mysql.h
file and
libmysqlclient.a
library used for compilation
to verify that they are from the new MySQL distribution. If not,
recompile the programs with the new headers and libraries.
Recompilation might also be necessary for programs compiled
against the shared client library if the library major version
number has changed (for example, from
libmysqlclient.so.17
to
libmysqlclient.so.18
). For additional
compatibility information, see
Section 28.7.4.4, “Running C API Client Programs”.
Clients have a maximum communication buffer size. The size of the buffer that is allocated initially (16KB) is automatically increased up to the maximum size (16MB by default). Because buffer sizes are increased only as demand warrants, simply increasing the maximum limit does not in itself cause more resources to be used. This size check is mostly a precaution against 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 session'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 default maximum built into the
client library is 1GB, but the default maximum in the server is 1MB.
You can increase this by changing the value of the
max_allowed_packet
parameter at
server startup. See Section 5.1.1, “Configuring the Server”.
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.
Traduction non disponible
Le manuel MySQL n'est pas encore traduit en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Document créé le 26/06/2006, dernière modification le 26/10/2018
Source du document imprimé : https://www.gaudry.be/mysql-rf-c-api.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.