18
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
21
#include <plugin/slave/queue_producer.h>
24
22
#include <drizzled/errmsg_print.h>
25
23
#include <drizzled/sql/result_set.h>
136
134
bool QueueProducer::openConnection()
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());
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());
159
drizzle_return_t ret= drizzle_con_connect(_connection);
157
drizzle_return_t ret= drizzle_con_connect(&_connection);
161
159
if (ret != DRIZZLE_RETURN_OK)
163
161
_last_return= ret;
164
162
_last_error_message= "Replication slave: ";
165
_last_error_message.append(drizzle_error(_drizzle));
163
_last_error_message.append(drizzle_error(&_drizzle));
166
164
errmsg_printf(error::ERROR, _("%s"), _last_error_message.c_str());
249
247
drizzle_return_t ret;
250
248
drizzle_result_st result;
251
drizzle_query_str(_connection, &result, sql.c_str(), &ret);
249
drizzle_query_str(&_connection, &result, sql.c_str(), &ret);
253
251
if (ret != DRIZZLE_RETURN_OK)
255
253
_last_return= ret;
256
254
_last_error_message= "Replication slave: ";
257
_last_error_message.append(drizzle_error(_drizzle));
255
_last_error_message.append(drizzle_error(&_drizzle));
258
256
errmsg_printf(error::ERROR, _("%s"), _last_error_message.c_str());
259
257
drizzle_result_free(&result);
267
265
_last_return= ret;
268
266
_last_error_message= "Replication slave: ";
269
_last_error_message.append(drizzle_error(_drizzle));
267
_last_error_message.append(drizzle_error(&_drizzle));
270
268
errmsg_printf(error::ERROR, _("%s"), _last_error_message.c_str());
271
269
drizzle_result_free(&result);
421
419
drizzle_return_t ret;
422
420
drizzle_result_st result;
423
drizzle_query_str(_connection, &result, sql.c_str(), &ret);
421
drizzle_query_str(&_connection, &result, sql.c_str(), &ret);
425
423
if (ret != DRIZZLE_RETURN_OK)
427
425
_last_return= ret;
428
426
_last_error_message= "Replication slave: ";
429
_last_error_message.append(drizzle_error(_drizzle));
427
_last_error_message.append(drizzle_error(&_drizzle));
430
428
errmsg_printf(error::ERROR, _("%s"), _last_error_message.c_str());
431
429
drizzle_result_free(&result);
441
439
_last_return= ret;
442
440
_last_error_message= "Replication slave: ";
443
_last_error_message.append(drizzle_error(_drizzle));
441
_last_error_message.append(drizzle_error(&_drizzle));
444
442
errmsg_printf(error::ERROR, _("%s"), _last_error_message.c_str());
445
443
drizzle_result_free(&result);