未验证 提交 0b17a5d0 编写于 作者: W wade zhang 提交者: GitHub

Merge pull request #21863 from taosdata/docs/adamji/TD-24884

docs: add···· description
...@@ -298,6 +298,8 @@ async fn main() -> anyhow::Result<()> { ...@@ -298,6 +298,8 @@ async fn main() -> anyhow::Result<()> {
} }
``` ```
> The query is consistent with operating a relational database. When using subscripts to get the contents of the returned fields, you have to start from 1. However, we recommend using the field names to get the values of the fields in the result set.
### Insert data ### Insert data
<RustInsert /> <RustInsert />
...@@ -316,10 +318,16 @@ let rs = taos.query_with_req_id("select * from stable where tag1 is null", 1)?; ...@@ -316,10 +318,16 @@ let rs = taos.query_with_req_id("select * from stable where tag1 is null", 1)?;
### Writing data via parameter binding ### Writing data via parameter binding
TDengine has significantly improved the bind APIs to support data writing (INSERT) scenarios. Writing data in this way avoids the resource consumption of SQL syntax parsing, resulting in significant write performance improvements in many cases.
Parameter binding details see [API Reference](#stmt-api)
<RustBind /> <RustBind />
### Schemaless Writing ### Schemaless Writing
TDengine supports schemaless writing. It is compatible with InfluxDB's Line Protocol, OpenTSDB's telnet line protocol, and OpenTSDB's JSON format protocol. For more information, see [Schemaless Writing](../../schemaless).
<RustSml /> <RustSml />
### Schemaless with req_id ### Schemaless with req_id
...@@ -567,9 +575,13 @@ Note that Rust asynchronous functions and an asynchronous runtime are required. ...@@ -567,9 +575,13 @@ Note that Rust asynchronous functions and an asynchronous runtime are required.
- `.create_database(database: &str)`: Executes the `CREATE DATABASE` statement. - `.create_database(database: &str)`: Executes the `CREATE DATABASE` statement.
- `.use_database(database: &str)`: Executes the `USE` statement. - `.use_database(database: &str)`: Executes the `USE` statement.
In addition, this structure is also the entry point for [Parameter Binding](#Parameter Binding Interface) and [Line Protocol Interface](#Line Protocol Interface). Please refer to the specific API descriptions for usage. In addition, this structure is also the entry point for Parameter Binding and Line Protocol Interface. Please refer to the specific API descriptions for usage.
<p>
<a id="stmt-api" style={{color:'#141414'}}>
Bind Interface Bind Interface
</a>
</p>
Similar to the C interface, Rust provides the bind interface's wrapping. First, the [Taos][struct.taos] object creates a parameter binding object [Stmt] for an SQL statement. Similar to the C interface, Rust provides the bind interface's wrapping. First, the [Taos][struct.taos] object creates a parameter binding object [Stmt] for an SQL statement.
......
...@@ -303,6 +303,8 @@ async fn main() -> anyhow::Result<()> { ...@@ -303,6 +303,8 @@ async fn main() -> anyhow::Result<()> {
} }
``` ```
> **注意**:如果不使用 `use db` 指定数据库,则后续对表的操作都需要增加数据库名称作为前缀,如 db.tb。
### 插入数据 ### 插入数据
<RustInsert /> <RustInsert />
...@@ -321,10 +323,16 @@ let rs = taos.query_with_req_id("select * from stable where tag1 is null", 1)?; ...@@ -321,10 +323,16 @@ let rs = taos.query_with_req_id("select * from stable where tag1 is null", 1)?;
### 通过参数绑定写入数据 ### 通过参数绑定写入数据
TDengine 的 Rust 连接器实现了参数绑定方式对数据写入(INSERT)场景的支持。采用这种方式写入数据时,能避免 SQL 语法解析的资源消耗,从而在很多情况下显著提升写入性能。
参数绑定接口详见[API参考](#stmt-api)
<RustBind /> <RustBind />
### 无模式写入 ### 无模式写入
TDengine 支持无模式写入功能。无模式写入兼容 InfluxDB 的 行协议(Line Protocol)、OpenTSDB 的 telnet 行协议和 OpenTSDB 的 JSON 格式协议。详情请参见[无模式写入](../../reference/schemaless/)。
<RustSml /> <RustSml />
### 执行带有 req_id 的无模式写入 ### 执行带有 req_id 的无模式写入
...@@ -570,9 +578,13 @@ let taos = pool.get()?; ...@@ -570,9 +578,13 @@ let taos = pool.get()?;
- `.create_database(database: &str)`: 执行 `CREATE DATABASE` 语句。 - `.create_database(database: &str)`: 执行 `CREATE DATABASE` 语句。
- `.use_database(database: &str)`: 执行 `USE` 语句。 - `.use_database(database: &str)`: 执行 `USE` 语句。
除此之外,该结构也是 [参数绑定](#参数绑定接口) 和 [行协议接口](#行协议接口) 的入口,使用方法请参考具体的 API 说明。 除此之外,该结构也是参数绑定和行协议接口的入口,使用方法请参考具体的 API 说明。
<p>
<a id="stmt-api" style={{color:'#141414'}}>
参数绑定接口 参数绑定接口
</a>
</p>
与 C 接口类似,Rust 提供参数绑定接口。首先,通过 [Taos][struct.Taos] 对象创建一个 SQL 语句的参数绑定对象 [Stmt]: 与 C 接口类似,Rust 提供参数绑定接口。首先,通过 [Taos][struct.Taos] 对象创建一个 SQL 语句的参数绑定对象 [Stmt]:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册