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];
## Import an xml file to replace the corresponding record
replace into table infile file name [where -index = 1] using tdr;
Parameter description:
Parameter | PB Table | TDR Table | Required |
---|---|---|---|
table | Table name | Table name | Yes |
key | Key field name. You can specify the value of partial key fields | Key field name. You can specify the value of partial key fields | Yes |
value | Non-primary key field name | Non-primary key field name | At least one or * |
-index | Generic 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 |
using tdr | Do not support | If using this parameter, you need to specify the TDR file corresponding to the target table through the startup parameter when starting the TcaplusDB client. When using this parameter, if the imported data file is in XML format, the file structure should strictly meet the XML syntax requirements |
No |
infile | Read data from file | Read data from file | No |
4. Command Example
Data file download used in the example:
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
tcaplus> replace into table_list infile result.xml where -index=1 using tdr;
replace success
replace time: 9836 us
5. Common Errors
Refer to Common Errors.
6. Related Documents
[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.