当前位置:网站首页>[tcapulusdb knowledge base] [list table] example code of batch deleting data at specified location in the list
[tcapulusdb knowledge base] [list table] example code of batch deleting data at specified location in the list
2022-06-23 03:45:00 【Tcapulus Jun】
【TcaplusDB The knowledge base 】[List surface ] Sample code for batch deletion of location data specified in the list
See Chapter : preparation .
Sample code
Sample code
import com.tencent.tcaplus.client.Client;
import com.tencent.tcaplus.client.ClientFactory;
import com.tencent.tcaplus.client.Record;
import com.tencent.tcaplus.client.Request;
import com.tencent.tcaplus.client.Response;
import com.tencent.tdr.tcaplus_protocol_cs.TcaplusProtocolCsConstants;
import java.util.ArrayList;
import java.util.List;
public class Example {
public static void main(String[] arguments) {
// 1. Prepare environmental information
// 1.1. Directory service address list
List<String> dirList = new ArrayList<String>();
dirList.add("tcp://x.x.x.x:9999");
dirList.add("tcp://y.y.y.y:9999");
// 1.2. Business ID
int appId = 1;
// 1.3. Business password
String appPassword = "****************";
// 1.4. Table group ID
int tableGroupId = 1;
// 1.5. Table name
String tableName = "test";
// 2. Create client
Client client = ClientFactory.createClient(appId, tableGroupId, appPassword, dirList);
try {
// 3. Construct a request to query data
// 3.1. Get request object . In order to improve SDK performance ,Request Objects are reusable
Request request = client.acquireRequest();
// 3.2. Set request type and target table name . Be careful : Target table must be List surface
request.setCmd(TcaplusProtocolCsConstants.TCAPLUS_CMD_LIST_DELETE_BATCH_REQ);
request.setTableName(tableName);
// 3.3. Set the list of each Key Value of field
Record record = request.addRecord();
record.setKeyInt("gameid", 1);
record.setKeyInt("itemid", 1);
record.setKeyString("name", "test");
// 3.4. Add the index number of the data to be deleted in the list , Multiple can be added . As in this example , Indicates that the... In the list is deleted 2 And the first 6 Data
request.AddElementIndex(1);
request.AddElementIndex(5);
// 4. Send a request , And get the results
Response response = client.poll(request);
// 5. Processing results
if (response.getResult() == 0) {
// Delete data succeeded
// TODO You can add the subsequent processing code of successful data deletion here
} else {
// Failed to delete data
// TODO You can add the subsequent processing code of data deletion failure here
}
} finally {
// 6. Destroy client objects
ClientFactory.destroyClient(client);
}
}
}TcaplusDB It's a distributed product of Tencent NoSQL database , The code for storage and scheduling is completely self-developed . With cache + Landing fusion architecture 、PB Levels of storage 、 Millisecond delay 、 Lossless horizontal expansion and complex data structure . At the same time, it has rich ecological environment 、 Easy migration 、 Extremely low operation and maintenance costs and five nine high availability features . Customer coverage game 、 Internet 、 government affairs 、 Finance 、 Manufacturing and the Internet of things .
边栏推荐
- Insérer le tri directement
- RTOS system selection for charging point software design
- [greed] leetcode991 Broken Calculator
- 【二叉树】993. Cousins in Binary Tree
- Heavyweight review: strategies for reliable fMRI measurements
- This point (II)
- China's economy has entered the stage of "the third mock examination coexisting", and JD and Shopify have jointly arranged global DTC
- 【LeetCode】翻转链表II
- How to get started with apiccloud app and multi terminal development of applet based on zero Foundation
- Analysis on development history, industrial chain, output and enterprise layout of medical polypropylene in China in 2020 [figure]
猜你喜欢

HAProxy的编译安装及全局配置段说明

直接插入排序

【二分】leetcode1011. Capacity To Ship Packages Within D Days
![[Zeng shuge's laser slam notes] gmapping filter based slam](/img/93/b940ad95508d1c0d23642022df37f2.png)
[Zeng shuge's laser slam notes] gmapping filter based slam
![[greed] leetcode991 Broken Calculator](/img/6e/ce552b55899c6e8d3c37f524f99f82.png)
[greed] leetcode991 Broken Calculator

软件项目管理 8.4.软件项目质量计划
![Analysis of China's integrated circuit industry chain in 2021: huge downstream market demand [figure]](/img/de/d73805aaf4345ca3d2a7baf85aab8d.jpg)
Analysis of China's integrated circuit industry chain in 2021: huge downstream market demand [figure]

Using jhipster to build microservice architecture

MySQL data recovery (.Ibdata1, bin log)

Google Earth Engine(GEE)——长时间序列逐月VCI数据提取分析和面积计算(墨西哥为例)
随机推荐
Goframe framework: log configuration management
Hierarchical attention graph convolution network for interpretable recommendation based on knowledge graph
Fetch request details
Not just offline caching- On how to make good use of serviceworker
[advanced Android] kotlin delegate attribute
线上MySQL的自增id用尽怎么办?
MySQL common instructions
Heavyweight review: strategies for reliable fMRI measurements
TRTC zero foundation -- Video subscription on the code
Static code block, code block, constructor execution order
【二分】leetcode1011. Capacity To Ship Packages Within D Days
LRU cache
If there is a smart bus visualization platform, can "beginning" restart indefinitely?
Customization of openfeign
redisTemplate和cacheManager操作redis有什么不同
What is the difference between the poll () method and the remove () method?
How to batch generate jan13 barcode
innodb_ruby 视角下 MySQL 记录增删改
centos7 安装 MySQL 及配置 innodb_ruby
Configuring multi cluster management using kubectl