当前位置:网站首页>[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 .
边栏推荐
- mysql 数据恢复 (.ibdata1, bin log)
- What is the difference between comparator and comparable?
- [burning] Tencent cloud high tech computing platform HTPC cloud elastic cluster release!
- Hierarchical attention graph convolution network for interpretable recommendation based on knowledge graph
- SwiftUI 组件大全之使用 ScrollView 和 GeometryReader 创建动画 3D卡片 滚动效果
- Easynvr is displayed online after cascading the upper platform, but what is the reason for the video playback timeout?
- What is the difference between the poll () method and the remove () method?
- Learning summary of spanquery source code
- Brief introduction to arm architecture
- What is the potential of dmail based on Web3.0? First round financing of $10 million?
猜你喜欢

1058 multiple choice questions (20 points)
![[two points] leetcode1011 Capacity To Ship Packages Within D Days](/img/fd/c6f31a44ebaf41bd5ab2a342f10d06.png)
[two points] leetcode1011 Capacity To Ship Packages Within D Days

直接插入排序

新版kali切换最高账户

mysql常用指令

LRU cache

选择排序法

【机器学习】 吴恩达机器学习作业 ex2逻辑回归 Matlab实现

Analysis on the development of China's graphene industry chain in 2021: with the support of energy conservation and environmental protection policies, the scale of graphene industry will continue to e

innodb_ruby 视角下 MySQL 记录增删改
随机推荐
Official announcement! The Hong Kong Zhuhai Macao Bridge is finally here!
Fetch request details
Simple analysis of easygbs compatible with old version HLS streaming address method [with code]
SwiftUI 组件大全之使用 ScrollView 和 GeometryReader 创建动画 3D卡片 滚动效果
[machine learning] wuenda's machine learning assignment ex2 logistic regression matlab implementation
China's economy has entered the stage of "the third mock examination coexisting", and JD and Shopify have jointly arranged global DTC
选择排序法
MySQL data recovery (.Ibdata1, bin log)
Tcapulusdb Jun · industry news collection (V)
Salesforce heroku (V) application in salesforce (canvasapp)
Analysis on demand and market scale of China's steamed stuffed bun industry in 2020 [figure]
[OWT] OWT client native P2P E2E test vs2017 construction 4: Construction and link of third-party databases p2pmfc exe
Static code block, code block, constructor execution order
【二叉树】993. Cousins in Binary Tree
【机器学习】 吴恩达机器学习作业 ex2逻辑回归 Matlab实现
The new version of Kali switches the highest account
Nezha panel modifies logo, small icon and other information
One of the touchdesigner uses - Download and install
【LeetCode】179. 最大数
Banknext microservice: a case study