Step 7: Replace Data

TcaplusDB Client - Replace Command

For TcaplusDB Client Instructions, see Document.

1. Function Descriptions

Replace the specified data. If the data does not exist, insert the data. If the data exists, replace the data (the value of the unspecified field will not be modified).

The -index field value must be provided for the list table, otherwise the replacement fails.

2. Initial Version

3.40.0

3. Command Syntax

## Display the value of the declaration parameter and resplace the corresponding data
replace into table (key1, key2, value1, vlaue2, value3) values (1, "abc", 2, "def", 0x123456, 1) [where -index = 1];

## Import a csv file to replace the corresponding record
replace into table infile file name [where -index = 1];

Parameter description:

ParameterPB TableTDR TableRequired
tableTable nameTable nameYes
keyKey field name. You can specify the value of partial key fieldsKey field name. You can specify the value of partial key fieldsYes
valueNon-primary key field nameNon-primary key field nameAt least one or *
-indexGeneric table: not supported.
List table: "- index" must be specified, and only the data at the specified position in the list can be replaced
Generic table: not supported.
List table: "- index" must be specified, and only the data at the specified position in the list can be replaced
Yes
infileRead data from fileRead data from fileNo

4. Command Example

Data file download used in the example:

  • result.csv

  • See Table Definition Example for table definition.

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

5. Common Errors

Refer to Common Errors.

[TDR Generic Table] [C++ SDK] Interface Description for Replacing a Record.

[TDR Generic Table] [Java SDK] Interface Description for Replacing a Record.

[TDR Generic Table] [Go SDK] Interface Description for Replacing a Record.

[TDR List Table][Java SDK] Interface Description for Replacing a Record.

[PB Generic Table] [C++ SDK] Interface Description for Replacing a Record.

[PB Generic Table] [Go SDK] Interface Description for Replacing a Record.

[PB Generic Table] [RESTFul API] Interface Description for Replacing a Record.