4
#include "master_list.pb.h"
8
Example reader application for master.info data.
11
void printRecord(const drizzle::MasterList *list)
15
for (x= 0; x < list->record_size(); x++)
17
const drizzle::MasterList_Record record= list->record(x);
19
cout << "HOSTNAME " << record.hostname() << endl;
20
if (record.has_username())
21
cout << "USERNAME " << record.username() << endl;
22
if (record.has_password())
23
cout << "PASSWORD " << record.password() << endl;
24
if (record.has_port())
25
cout << "PORT " << record.port() << endl;
26
if (record.has_connect_retry())
27
cout << "CONNECT RETRY " << record.connect_retry() << endl;
28
if (record.has_log_name())
29
cout << "LOG NAME " << record.log_name() << endl;
30
if (record.has_log_position())
31
cout << "LOG POSITION " << record.log_position() << endl;
36
int main(int argc, char* argv[])
38
GOOGLE_PROTOBUF_VERIFY_VERSION;
42
cerr << "Usage: " << argv[0] << " master.info " << endl;
46
drizzle::MasterList list;
49
// Read the existing master.info file
50
fstream input(argv[1], ios::in | ios::binary);
51
if (!list.ParseFromIstream(&input))
53
cerr << "Failed to parse master.info." << endl;