tencent cloud

TencentDB for TcaplusDB

Release Notes
Product Introduction
Product Overview
Benefits
Use Cases
Architecture
Regions
Purchase Guide
Product Pricing
Payment Overdue
Getting Started
Basic Concepts
Creating Cluster
Creating Table Group
Creating Table
Get Connection Information
Accessing TcaplusDB
Operation Guide
Managing Cluster and Table Group
Managing Table
Monitoring and Alarming
Access Management
Tag
Task List
TcaplusDB Client
Accessing by Client Tool
Client Tool Commands
TcaplusDB SDK
Release History
SDK Download
C++ SDK API
TcaplusDB Error Codes
SDK Installation
Directions for Protobuf Table SDK for C++
Directions for TDR Table SDK for C++
TcaplusDB RESTful APIs
Description
Go
Java
PHP
Python
Downloading RESTful API Samples in Multiple Languages
Practical Tutorial
Best Practice for Table Structure Design
Best Practice for Database Interaction
FAQs
Database Features
Database Use
Database Principles
API Documentation
History
Introduction
API Category
Making API Requests
Table Group APIs
Other APIs
Table APIs
Cluster APIs
Data Types
Error Codes
Service Agreement
Service Level Agreement
Terms of Service
Glossary
Contact Us

insert

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2024-12-04 10:12:05

Overview

This command is used to insert a data entry into a table by explicitly declaring parameters or importing files.

Syntax

## Explicitly Declaring Parameters to Insert Data
insert into table (key1, key2, value1, vlaue2) values (1, "abc", 2, "def") [after -1] [shift none/head/tail];

## Importing a CSV File to Insert Data
insert into table infile result.csv [after -1] [shift none/head/tail];

## Importing an XML File to Insert Data Provided that the TDR File Is Provided at the Client’s Startup
insert into table infile result.xml [after -1] [shift none/head/tail] using tdr;

Parameters

Parameter
Protobuf and TDR
Required
table
Table name
Yes
key
Primary key field name
Yes
value
Non-primary key field name
Yes, at least one
after
LIST table:
n>0 indicates that the data will be inserted after the first n data
n=-2 indicates that the data will be inserted at the head of the queue
n=-1 indicates that the data will be inserted at the tail of the queue
n<-2: unsupported
GENERIC table: this field is unsupported.
No
shift
If the table size exceeds the maximum value, you can specify how to clear data automatically. Valid values:
none: no data will be cleared
head: data at the head of the queue will be cleared
tail: data at the tail of the queue will be cleared.
No
using tdr
The Protobuf table does not support this parameter. To insert data into the TDR table, import an XML file whose structure must strictly comply with the XML syntax. In addition, a TDR file must be provided when the client is started.
No
infile
Read data from the file
No

Errors

For more information, see Error Codes.

Sample

Download the sample file result.xml and result.csv.
tcaplus>insert into game_players (player_id,player_name,player_email,game_server_id) values (2,name,email,2);
insert success

insert time: 45322 us

tcaplus> Insert into table_list (uin, name, key1) values (99,99,99) after -1 shift tail;

insert success

insert time: 22464 us

tcaplus> Insert into table_list infile result.xml using tdr;


insert success

insert time: 9493 us

tcaplus> Insert into table_list infile result.csv;


insert success

insert time: 22368 us


도움말 및 지원

문제 해결에 도움이 되었나요?

피드백