当前位置:网站首页>[tcapulusdb knowledge base] [list table] example code for deleting the data at the specified location in the list
[tcapulusdb knowledge base] [list table] example code for deleting the data at the specified location in the list
2022-06-23 03:45:00 【Tcapulus Jun】
【TcaplusDB The knowledge base 】[List surface ] Sample code for deleting 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_REQ);
request.setTableName(tableName);
// 3.3. because List In the table , Can be more Key Same data , So when you call some interfaces ,
// You need to specify which data in the data list to delete , In this case 0, Take the first place 1 individual , And so on
Record record = request.addRecord(0);
// 3.4. Set the list of each Key Value of field
record.setKeyInt("gameid", 1);
record.setKeyInt("itemid", 1);
record.setKeyString("name", "test");
// 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 .
边栏推荐
- 直接插入排序
- [metauniverse 7ai rope skipping] how is this app light application realized? What are the application scenarios?
- Half search method
- Golang resource embedding scheme
- Summary of some precautions and problems in the use of tars framework (mengxinxiang)
- Full analysis of embedded software testing tool tpt18 update
- Analysis of the number of urban residents covered by basic medical insurance, their treatment and medical treatment in other places in China in 2021 [figure]
- Get method of fetch request and data of formdata type submitted by post
- [JS reverse hundreds of cases] the login of a HN service network is reverse, and the verification code is null and void
- pyspark,有偿询问数据清洗和上传到数据库的问题
猜你喜欢

Centos7 installing MySQL and configuring InnoDB_ ruby

Select sort method
![Analysis of the number of urban residents covered by basic medical insurance, their treatment and medical treatment in other places in China in 2021 [figure]](/img/81/4d3cb059f700dd9243645e64023be7.jpg)
Analysis of the number of urban residents covered by basic medical insurance, their treatment and medical treatment in other places in China in 2021 [figure]

R tree of search tree

线上MySQL的自增id用尽怎么办?

选择排序法

Hierarchical attention graph convolution network for interpretable recommendation based on knowledge graph

Using jhipster to build microservice architecture

软件项目管理 8.4.软件项目质量计划

【机器学习】 吴恩达机器学习作业 ex2逻辑回归 Matlab实现
随机推荐
【机器学习】 吴恩达机器学习作业 ex2逻辑回归 Matlab实现
Select sort method
C. Differential Sorting
Heavyweight review: strategies for reliable fMRI measurements
What is the difference between ArrayList and array?
Summary of some precautions and problems in the use of tars framework (mengxinxiang)
页面导出excel的三种方式
The MIUI 13 development version of Xiaomi mobile phone blocks the chrome application and cannot be opened after installation
Swiftui component encyclopedia creating animated 3D card scrolling effects using Scrollview and geometryreader
Talk about memory model and memory order
【LeetCode】23. 合并K个升序链表
Flink practice tutorial: advanced 7- basic operation and maintenance
mysql优化,sql执行非常卡顿,不改变sql结构达到10秒内结束
[tcapulusdb knowledge base] [list table] example code of batch deleting data at specified location in the list
How to batch generate jan13 barcode
【曾书格激光SLAM笔记】Gmapping基于滤波器的SLAM
[metauniverse 7ai rope skipping] how is this app light application realized? What are the application scenarios?
Composition and simple classification of IP addresses
Stress testing with locust on rainbow
Why APP But Not WebPage