当前位置:网站首页>[in depth understanding of tcallusdb technology] sample code for reading data - [generic table]
[in depth understanding of tcallusdb technology] sample code for reading data - [generic table]
2022-04-22 15:14:00 【Database master】
Preparation of this paper
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
request.setCmd(TcaplusProtocolCsConstants.TCAPLUS_CMD_GET_REQ);
request.setTableName(tableName);
// 3.3. Set 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 to query Value Field
request.addFieldName("typeid");
request.addFieldName("Data");
request.addFieldName("uname");
// 4. Send a request , And get the results
Response response = client.poll(request);
// 5. Processing results
if (response.getResult() == 0) {
// Read data successfully
Record result = response.fetchRecord();
// TODO The subsequent processing code of successful data reading can be added here
} else {
// Failed to read data
// TODO The subsequent processing code of data reading failure can be added 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 .
版权声明
本文为[Database master]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204221501394939.html
边栏推荐
猜你喜欢

Web automated testing

Tcallusdb Jun · industry news compilation (V)

Face recognition (5) face detection based on mctnn (pytoch)

Redis的线程模型

2022年化工自动化控制仪表考试题库及在线模拟考试

Record an SQL, query the company where the user last worked, and search according to the enterprise name + user name

Saving notes 20: transforming notebook computer (ASUS a555l)

【图】207. 课程表
![【深入理解TcaplusDB技术】批量读取数据示例代码——[Generic表]](/img/7b/8c4f1549054ee8c0184495d9e8e378.png)
【深入理解TcaplusDB技术】批量读取数据示例代码——[Generic表]

Memcpy() function copies two-dimensional array & memcmp() function compares two-dimensional array
随机推荐
恶意软件分析– Ursnif Trojan
Sequential list -- basic implementation of one-way headless linked list
【Yolact数据集制作-labelme使用与转coco详解】
你知道如何生成随机数吗?(三千字超详细)
【深入理解TcaplusDB技术】读取列表指定位置数据示例代码——[List表]
ArcGIS calls the worldwayback historical image and exports the animation
Web自动化测试
傅里叶分析和滤波
View your own system activation type
Tcallusdb Jun · industry news compilation (III)
思科模拟器EVE-NG如何导入镜像
职场PUA,管理者的五宗罪
Analysis on the characteristics of the official game economic model launched by platoffarm
Installation and use of distributed task scheduling platform xxl-job
ROS通信机制三---参数服务器
Watch out for spies! Safeguard national security, you and I guard together
824. 山羊拉丁文
【深入理解TcaplusDB技术】读取列表指定位置数据接口说明——[List表]
2022 chemical automation control instrument examination question bank and online simulation examination
vscode处理代码合并冲突