add note for sql using in parameter binding insertion
This commit is contained in:
parent
081c902c64
commit
40a89c04bf
|
@ -15,6 +15,16 @@ When inserting data using parameter binding, it can avoid the resource consumpti
|
||||||
|
|
||||||
**Tips: It is recommended to use parameter binding for data insertion**
|
**Tips: It is recommended to use parameter binding for data insertion**
|
||||||
|
|
||||||
|
:::note
|
||||||
|
We only recommend using the following two forms of SQL for parameter binding data insertion:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
1. INSERT INTO meters (tbname, ts, current, voltage, phase, location, group_id) VALUES(?, ?, ?, ?, ?, ?, ?)
|
||||||
|
2. INSERT INTO ? USING meters TAGS (?, ?) VALUES (?, ?, ?, ?)
|
||||||
|
```
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
Next, we continue to use smart meters as an example to demonstrate the efficient writing functionality of parameter binding with various language connectors:
|
Next, we continue to use smart meters as an example to demonstrate the efficient writing functionality of parameter binding with various language connectors:
|
||||||
|
|
||||||
1. Prepare a parameterized SQL insert statement for inserting data into the supertable `meters`. This statement allows dynamically specifying subtable names, tags, and column values.
|
1. Prepare a parameterized SQL insert statement for inserting data into the supertable `meters`. This statement allows dynamically specifying subtable names, tags, and column values.
|
||||||
|
|
|
@ -15,6 +15,16 @@ import TabItem from "@theme/TabItem";
|
||||||
|
|
||||||
**Tips: 数据写入推荐使用参数绑定方式**
|
**Tips: 数据写入推荐使用参数绑定方式**
|
||||||
|
|
||||||
|
:::note
|
||||||
|
我们只推荐使用下面两种形式的 SQL 进行参数绑定写入:
|
||||||
|
|
||||||
|
```sql
|
||||||
|
1. INSERT INTO meters (tbname, ts, current, voltage, phase, location, group_id) VALUES(?, ?, ?, ?, ?, ?, ?)
|
||||||
|
2. INSERT INTO ? USING meters TAGS (?, ?) VALUES (?, ?, ?, ?)
|
||||||
|
```
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
下面我们继续以智能电表为例,展示各语言连接器使用参数绑定高效写入的功能:
|
下面我们继续以智能电表为例,展示各语言连接器使用参数绑定高效写入的功能:
|
||||||
1. 准备一个参数化的 SQL 插入语句,用于向超级表 `meters` 中插入数据。这个语句允许动态地指定子表名、标签和列值。
|
1. 准备一个参数化的 SQL 插入语句,用于向超级表 `meters` 中插入数据。这个语句允许动态地指定子表名、标签和列值。
|
||||||
2. 循环生成多个子表及其对应的数据行。对于每个子表:
|
2. 循环生成多个子表及其对应的数据行。对于每个子表:
|
||||||
|
|
Loading…
Reference in New Issue