本文整理汇总了C++中ObString::assign_buffer方法的典型用法代码示例。如果您正苦于以下问题:C++ ObString::assign_buffer方法的具体用法?C++ ObString::assign_buffer怎么用?C++ ObString::assign_buffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObString
的用法示例。
在下文中一共展示了ObString::assign_buffer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: refresh_new_config
int ObDirectTriggerEventUtil::refresh_new_config(ObResultSet &result, ObSqlContext &context)
{
int err = OB_SUCCESS;
// fire an event to tell all clusters
char buf[OB_MAX_SQL_LENGTH] = "";
ObString stmt;
stmt.assign_buffer(buf, sizeof (buf));
if (OB_SUCCESS != (err = ObTriggerEventUtil::format(stmt, REFRESH_NEW_CONFIG_TRIGGER, 0)))
{
TBSYS_LOG(WARN, "fail to format sql. err=%d", err);
}
else if (OB_SUCCESS != (err = ObSql::direct_execute(stmt, result, context)))
{
TBSYS_LOG(ERROR, "fail to trigger refresh_new_config event. err[%d]", err);
}
else
{
TBSYS_LOG(INFO, "trigger refresh_new_config event succ: err[%d]", err);
}
return err;
}
示例2: tester
//migrate_over
TEST(ObRootServer2Test2, migrate_over)
{
// init make a root table
ObRootServer2* root_server;
ObRootWorkerForTest worker;
root_server = worker.get_root_server();
int64_t now = tbsys::CTimeUtil::getTime();
ASSERT_TRUE(root_server->init("./root_server.conf", 100, &worker));
ObRootServerTester tester(root_server);
ObServer server(ObServer::IPV4, "10.10.10.1", 1001);
ObServer server2(ObServer::IPV4, "10.10.10.2", 1001);
ObServer server3(ObServer::IPV4, "10.10.10.3", 1001);
ObServer server4(ObServer::IPV4, "10.10.10.4", 1001);
ASSERT_TRUE(!(server == server2));
int64_t time_stamp = now;
root_server->start_threads();
int status;
tester.get_wait_init_time() = 2 * 1000000;
sleep(2);
int ret = root_server->regist_server(server, false, status);
ASSERT_EQ(OB_SUCCESS, ret);
ret = root_server->regist_server(server2, false, status);
ASSERT_EQ(OB_SUCCESS, ret);
// now we have two cs
tester.get_lease_duration() = 100 * 1000 * 1000;
TBSYS_LOG(INFO, "will start test");
//tester.init_root_table_by_report();
TBSYS_LOG(INFO, "over send start_new_schema now %d have sended",worker.start_new_send_times);
time_stamp = 0;
//all commond sended.
//mimic report
char buf1[10][30];
char buf2[10][30];
//const common::ObTabletInfo& tablet, const common::ObTabletLocation& location)
ObTabletReportInfoList report_list1;
ObTabletReportInfoList report_list2;
ObTabletReportInfo report_info;
ObTabletInfo info1;
ObTabletLocation location;
location.tablet_version_ = 1;
info1.range_.table_id_ = 10001;
info1.range_.border_flag_.set_inclusive_end();
info1.range_.border_flag_.unset_inclusive_start();
info1.range_.border_flag_.set_min_value();
info1.range_.border_flag_.unset_max_value();
info1.range_.start_key_.assign_buffer(buf1[0], 30);
info1.range_.end_key_.assign_buffer(buf2[0], 30);
info1.range_.start_key_.write("aa1", 3);
info1.range_.end_key_.write("ba1", 3);
location.chunkserver_ = server;
report_info.tablet_info_ = info1;
report_info.tablet_location_ = location;
report_list1.add_tablet(report_info);
//ASSERT_EQ(0,root_server.got_reported(info1, location)); //(,"ba1"] server
info1.range_.border_flag_.unset_min_value();
info1.range_.start_key_.assign_buffer(buf1[1], 30);
info1.range_.end_key_.assign_buffer(buf2[1], 30);
info1.range_.start_key_.write("ba1", 3);
info1.range_.end_key_.write("ca1", 3);
report_info.tablet_info_ = info1;
report_info.tablet_location_ = location;
report_list1.add_tablet(report_info);
ret = root_server->report_tablets(server, report_list1,time_stamp);
ASSERT_EQ(OB_SUCCESS, ret);
location.chunkserver_ = server2;
info1.range_.start_key_.assign_buffer(buf1[3], 30);
info1.range_.end_key_.assign_buffer(buf2[3], 30);
info1.range_.start_key_.write("da1", 3);
info1.range_.end_key_.write("ea1", 3);
report_info.tablet_info_ = info1;
report_info.tablet_location_ = location;
report_list2.add_tablet(report_info);
info1.range_.start_key_.assign_buffer(buf1[2], 30);
info1.range_.end_key_.assign_buffer(buf2[2], 30);
info1.range_.start_key_.write("ca1", 3);
info1.range_.end_key_.write("da1", 3);
report_info.tablet_info_ = info1;
report_info.tablet_location_ = location;
report_list2.add_tablet(report_info);
info1.range_.start_key_.assign_buffer(buf1[4], 30);
info1.range_.end_key_.assign_buffer(buf2[4], 30);
//.........这里部分代码省略.........