本文整理汇总了C++中Customer::c_nationkey方法的典型用法代码示例。如果您正苦于以下问题:C++ Customer::c_nationkey方法的具体用法?C++ Customer::c_nationkey怎么用?C++ Customer::c_nationkey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Customer
的用法示例。
在下文中一共展示了Customer::c_nationkey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TEST(DataStore, updateData) {
ResultCode status;
shared_ptr<CustomerKey> customerKey1(new CustomerKey);
customerKey1->set_c_custkey(11000);
shared_ptr<Customer> customer1(new Customer);
customer1->set_c_name("Kate");
customer1->set_c_nationkey(50);
customer1->set_c_phone("13800138000");
StoreKey<Message> key1(customerKey1);
StoreValue<Message> value1(customer1);
status = ::idgs::util::singleton<DataStore>::getInstance().updateData("Customer", key1, value1);
ASSERT_TRUE(status == RC_SUCCESS);
shared_ptr<CustomerKey> customerKey2(new CustomerKey);
customerKey2->set_c_custkey(11000);
shared_ptr<Customer> customer2(new Customer);
StoreKey<Message> key2(customerKey2);
StoreValue<Message> value2(customer2);
status = ::idgs::util::singleton<DataStore>::getInstance().getData("Customer", key2, value2);
ASSERT_TRUE(status == RC_SUCCESS);
ASSERT_TRUE(value2.get() != NULL);
Customer* result = (Customer *) value2.get().get();
ASSERT_EQ("Kate", result->c_name());
ASSERT_EQ(50, result->c_nationkey());
ASSERT_EQ("13800138000", result->c_phone());
}
示例2:
TEST(DataStore, get) {
ResultCode status;
StoreOption ps;
hashcode_t hash;
shared_ptr<CustomerKey> customerKey1 = make_shared<CustomerKey>();
customerKey1->set_c_custkey(11000);
shared_ptr<Customer> customer1 = make_shared<Customer>();
StoreKey<Message> key1(customerKey1);
StoreValue<Message> value1(customer1);
auto store = idgs::store_test::datastore.getStore("Customer");
hash = protobuf::HashCode::hashcode(key1.get());
ps.partitionId = (hash % idgs::store_test::partSize);
status = store->get(key1, value1, &ps);
ASSERT_EQ(RC_SUCCESS, status);
Customer* result = (Customer *) value1.get().get();
ASSERT_EQ("Tom1", result->c_name());
ASSERT_EQ(20, result->c_nationkey());
ASSERT_EQ("13800138000", result->c_phone());
shared_ptr<CustomerKey> customerKey2 = make_shared<CustomerKey>();
customerKey2->set_c_custkey(12010);
shared_ptr<Customer> customer2 = make_shared<Customer>();
StoreKey<Message> key2(customerKey2);
StoreValue<Message> value2(customer2);
hash = protobuf::HashCode::hashcode(key2.get());
ps.partitionId = (hash % idgs::store_test::partSize);
status = store->get(key2, value2, &ps);
ASSERT_EQ(RC_SUCCESS, status);
shared_ptr<CustomerKey> customerKey3 = make_shared<CustomerKey>();
customerKey3->set_c_custkey(20000);
StoreKey<Message> key3(customerKey3);
StoreValue<Message> value3(make_shared<Customer>());
hash = protobuf::HashCode::hashcode(key3.get());
ps.partitionId = (hash % idgs::store_test::partSize);
status = store->get(key3, value3, &ps);
ASSERT_EQ(RC_DATA_NOT_FOUND, status);
}