18
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
23
#include <plugin/slave/queue_producer.h>
22
24
#include <drizzled/errmsg_print.h>
23
25
#include <drizzled/sql/result_set.h>
134
136
bool QueueProducer::openConnection()
136
if (drizzle_create(&_drizzle) == NULL)
138
_last_return= DRIZZLE_RETURN_INTERNAL_ERROR;
139
_last_error_message= "Replication slave: ";
140
_last_error_message.append(drizzle_error(&_drizzle));
141
errmsg_printf(error::ERROR, _("%s"), _last_error_message.c_str());
145
if (drizzle_con_create(&_drizzle, &_connection) == NULL)
147
_last_return= DRIZZLE_RETURN_INTERNAL_ERROR;
148
_last_error_message= "Replication slave: ";
149
_last_error_message.append(drizzle_error(&_drizzle));
150
errmsg_printf(error::ERROR, _("%s"), _last_error_message.c_str());
154
drizzle_con_set_tcp(&_connection, _master_host.c_str(), _master_port);
155
drizzle_con_set_auth(&_connection, _master_user.c_str(), _master_pass.c_str());
138
if ((_drizzle= drizzle_create()) == NULL)
140
_last_return= DRIZZLE_RETURN_INTERNAL_ERROR;
141
_last_error_message= "Replication slave: ";
142
_last_error_message.append(drizzle_error(_drizzle));
143
errmsg_printf(error::ERROR, _("%s"), _last_error_message.c_str());
147
if ((_connection= drizzle_con_create(_drizzle)) == NULL)
149
_last_return= DRIZZLE_RETURN_INTERNAL_ERROR;
150
_last_error_message= "Replication slave: ";
151
_last_error_message.append(drizzle_error(_drizzle));
152
errmsg_printf(error::ERROR, _("%s"), _last_error_message.c_str());
156
drizzle_con_set_tcp(_connection, _master_host.c_str(), _master_port);
157
drizzle_con_set_auth(_connection, _master_user.c_str(), _master_pass.c_str());
157
drizzle_return_t ret= drizzle_con_connect(&_connection);
159
drizzle_return_t ret= drizzle_con_connect(_connection);
159
161
if (ret != DRIZZLE_RETURN_OK)
161
163
_last_return= ret;
162
164
_last_error_message= "Replication slave: ";
163
_last_error_message.append(drizzle_error(&_drizzle));
165
_last_error_message.append(drizzle_error(_drizzle));
164
166
errmsg_printf(error::ERROR, _("%s"), _last_error_message.c_str());
247
249
drizzle_return_t ret;
248
250
drizzle_result_st result;
249
drizzle_query_str(&_connection, &result, sql.c_str(), &ret);
251
drizzle_query_str(_connection, &result, sql.c_str(), &ret);
251
253
if (ret != DRIZZLE_RETURN_OK)
253
255
_last_return= ret;
254
256
_last_error_message= "Replication slave: ";
255
_last_error_message.append(drizzle_error(&_drizzle));
257
_last_error_message.append(drizzle_error(_drizzle));
256
258
errmsg_printf(error::ERROR, _("%s"), _last_error_message.c_str());
257
259
drizzle_result_free(&result);
265
267
_last_return= ret;
266
268
_last_error_message= "Replication slave: ";
267
_last_error_message.append(drizzle_error(&_drizzle));
269
_last_error_message.append(drizzle_error(_drizzle));
268
270
errmsg_printf(error::ERROR, _("%s"), _last_error_message.c_str());
269
271
drizzle_result_free(&result);
419
421
drizzle_return_t ret;
420
422
drizzle_result_st result;
421
drizzle_query_str(&_connection, &result, sql.c_str(), &ret);
423
drizzle_query_str(_connection, &result, sql.c_str(), &ret);
423
425
if (ret != DRIZZLE_RETURN_OK)
425
427
_last_return= ret;
426
428
_last_error_message= "Replication slave: ";
427
_last_error_message.append(drizzle_error(&_drizzle));
429
_last_error_message.append(drizzle_error(_drizzle));
428
430
errmsg_printf(error::ERROR, _("%s"), _last_error_message.c_str());
429
431
drizzle_result_free(&result);
439
441
_last_return= ret;
440
442
_last_error_message= "Replication slave: ";
441
_last_error_message.append(drizzle_error(&_drizzle));
443
_last_error_message.append(drizzle_error(_drizzle));
442
444
errmsg_printf(error::ERROR, _("%s"), _last_error_message.c_str());
443
445
drizzle_result_free(&result);