TcaplusDB Client - replace命令

TcaplusDB Client的使用方法参见文档

1. 功能说明

替换指定数据 1) 对于generic表,如果数据不存在则插入数据,如果数据存在则替换数据(不会修改未指定的字段的值)。

2) 对于list表,必须提供-index字段值,若数据存在则替换对应数据,若不存在则替换失败。

2. 启始版本

3.40.0

3. 命令语法

##显示声明字段的值,替换对应的记录
replace into table (key1, key2, value1, vlaue2, value3) values (1, "abc", 2, "def", 0x123456, 1) [where -index = 1];

##导入csv文件替换对应的记录
replace into table infile 文件名 [where -index = 1];

##导入xml文件替换对应的记录
replace into table infile 文件名 [where -index = 1] using tdr;

参数说明:

参数 PB表 TDR表 必填项
table 表格的名字 表格的名字
key 主键字段名,必须填入键字段的值 主键字段名,必须填入键字段的值
value 非主键字段名 非主键字段名 至少一个或 *
-index Generic表:不支持
List表:必须指定 "-index", 只替换列表中指定位置的数据
Generic表:不支持
List表:必须指定 "-index", 只替换列表中指定位置的数据
using tdr 不支持 如果需要使用该参数,则在启动TcaplusDB Client时,就要通过启动参数指定与目标表对应的TDR文件
使用该参数时,如果导入的是XML格式的数据文件,则文件结构严格满足XML语法要求
infile 从文件中读取数据 从文件中读取数据

4. 命令示例

示例中使用的数据文件下载链接:

  • result.csv

  • result.xml

  • 表定义详见示例表定义。 ``` tcaplus> replace into table_generic_xiahuaxian (_uin, name, _key3, key4, binary_count, c_binary,c_binary1,c_binary2,c_binary3) values (99, "danmi_test_1", 4, 9, 3,0x64616e, 0x646162, 0x646162, 0x646162);

replace success

replace time: 42036 us

tcaplus> replace into table_list (uin, name, key1,level,count) values (99,99,99,22,11) where -index=1;

replace success

replace time: 10109 us

tcaplus> replace into table_list infile result.csv where -index=1;

replace success

replace time: 10054 us

tcaplus> replace into table_list infile result.xml where -index=1 using tdr;

replace success

replace time: 9836 us ```

5. 常见错误

参考常见错误文档。

6. 相关文档

[TDR Generic表][C++ SDK]替换单条数据接口说明

[TDR Generic表][Java SDK]替换单条数据接口说明

[TDR Generic表][Go SDK]替换单条数据接口说明

[TDR List表][Java SDK]替换单条数据接口说明

[PB Generic表][C++ SDK]替换单条数据接口说明

[PB Generic表][Go SDK]替换单条数据接口说明

[PB Generic表][RESTFul API]替换单条数据接口说明

results matching ""

    No results matching ""