Rechercher dans le manuel MySQL
28.7.19 C API Binary Log Data Structures
C API functions for processing a replication event stream from a
server require a connection handler (a MYSQL *
pointer) and a pointer to a MYSQL_RPL structure
that describes the steam of replication events to read from the
server binary log. For example:
MYSQL *mysql = mysql_real_connect(...);
MYSQL_RPL rpl;
# ... initialize MYSQL_RPL members ...
int result = mysql_binlog_open(mysql, &rpl);
This section describes the MYSQL_RPL structure
members. Connection handlers are described in
Section 28.7.5, “C API Data Structures”.
The applicable MYSQL_RPL members depend on the
binary log operation to be performed:
Before calling
mysql_binlog_open(), the caller must set theMYSQL_RPLmembers fromfile_name_lengththroughflags. In addition, ifflagshas theMYSQL_RPL_GTIDflag set, the caller must set the members fromgtid_set_encoded_sizethroughgtid_set_arg.After a successful
mysql_binlog_fetch()call, the caller examines thesizeandbuffermembers.
MYSQL_RPL structure member descriptions:
file_name_lengthThe length of the name of the binary log file to read. This member is used in conjunction with
file_name; see thefile_namedescription.file_nameThe name of the binary log file to read:
If
file_nameisNULL, the client library sets it to the empty string and setsfile_name_lengthto 0.If
file_nameis notNULL,file_name_lengthmust either be the length of the name or 0. Iffile_name_lengthis 0, the client library sets it to the length of the name, in which case,file_namemust be given as a null-terminated string.
To read from the beginning of the binary log without having to know the name of the oldest binary log file, set
file_nametoNULLor the empty string, andstart_positionto 4.start_positionThe position at which to start reading the binary log. The position of the first event in any given binary log file is 4.
server_idThe server ID to use for identifying to the server from which the binary log is read.
flagsThe union of flags that affect binary log reading, or 0 if no flags are set. These flag values are permitted:
MYSQL_RPL_SKIP_HEARTBEATSet this flag to cause
mysql_binlog_fetch()to skip heartbeat events.MYSQL_RPL_GTIDSet this flag to read GTID (global transaction ID) data. If set, you must initialize the
MYSQL_RPLstructure GTID-related members fromgtid_set_encoded_sizetogtid_set_argbefore callingmysql_binlog_open().It is beyond the scope of this documentation to describe in detail how client programs use those GTID-related members. For more information, examine the
mysqlbinlog.ccsource file. For information about GTID-based replication, see Section 17.1.3, “Replication with Global Transaction Identifiers”.
gtid_set_encoded_sizeThe size of GTID set data, or 0.
fix_gtid_setThe address of a callback function for
mysql_binlog_open()to call to fill the command packet GTID set, orNULLif there is no such function. The callback function, if used, should have this calling signature:void my_callback(MYSQL_RPL *rpl, unsigned char *packet_gtid_set);gtid_set_argEither a pointer to GTID set data (if
fix_gtid_setisNULL), or a pointer to a value to be made available for use within the callback function (iffix_gtid_setis notNULL).gtid_set_argis a generic pointer, so it can point to any kind of value (for example, a string, a structure, or a function). Its interpretation within the callback depends on how the callback intends to use it.sizeAfter a successful
mysql_binlog_fetch()call, the size of the returned binary log event. The value is 0 for an EOF event, greater than 0 for a non-EOF event.bufferAfter a successful
mysql_binlog_fetch()call, a pointer to the binary log event contents.
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 26/06/2006, zuletzt geändert 26/10/2018
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/mysql-rf-c-api-binary-log-data-structures.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor dieser Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.