Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: taos api description #22493

Merged
merged 2 commits into from
Aug 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions docs/en/14-reference/03-connector/03-cpp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ The base API is used to do things like create database connections and provide a

:::

- `TAOS *taos_connect_auth(const char *host, const char *user, const char *auth, const char *db, uint16_t port)`

The function is the same as taos_connect. Except that the pass parameter is replaced by auth, other parameters are the same as taos_connect.

- auth: the 32-bit lowercase md5 of the raw password

- `char *taos_get_server_info(TAOS *taos)`

Get server-side version information.
Expand All @@ -184,6 +190,14 @@ The base API is used to do things like create database connections and provide a
- If len is less than the space required to store the db (including the last '\0'), an error is returned. The truncated data assigned in the database ends with '\0'.
- If len is greater than or equal to the space required to store the db (including the last '\0'), return normal 0, and assign the db name ending with '\0' in the database.

- `int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t fp, void *param, int type)`

Set the event callback function.

- fp: event callback function pointer. Declaration:typedef void (*__taos_notify_fn_t)(void *param, void *ext, int type);Param is a user-defined parameter, ext is an extended parameter (depending on the event type, and returns the user password version for TAOS_NOTIFY_PASSVER), and type is the event type
- param: user-defined parameter
- type: event type. Value range: 1) TAOS_NOTIFY_PASSVER: User password changed

- `void taos_close(TAOS *taos)`

Closes the connection, where `taos` is the handle returned by `taos_connect()`.
Expand Down Expand Up @@ -358,6 +372,14 @@ The specific functions related to the interface are as follows (see also the [pr

Execute the prepared statement. Currently, a statement can only be executed once.

- `int taos_stmt_affected_rows(TAOS_STMT *stmt)`

Gets the number of rows affected by executing bind statements multiple times.

- `int taos_stmt_affected_rows_once(TAOS_STMT *stmt)`

Gets the number of rows affected by executing a bind statement once.

- `TAOS_RES* taos_stmt_use_result(TAOS_STMT *stmt)`

Gets the result set of a statement. Use the result set in the same way as in the non-parametric call. When finished, `taos_free_result()` should be called on this result set to free resources.
Expand Down
22 changes: 22 additions & 0 deletions docs/zh/08-connector/10-cpp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,12 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields)

:::

- `TAOS *taos_connect_auth(const char *host, const char *user, const char *auth, const char *db, uint16_t port)`

功能同 taos_connect。除 pass 参数替换为 auth 外,其他参数同 taos_connect。

- auth: 原始密码取 32 位小写 md5

- `char *taos_get_server_info(TAOS *taos)`

获取服务端版本信息。
Expand All @@ -272,6 +278,14 @@ int taos_print_row(char *str, TAOS_ROW row, TAOS_FIELD *fields, int num_fields)
- 如果,len 小于 存储db需要的空间(包含最后的'\0'),返回错误,database里赋值截断的数据,以'\0'结尾。
- 如果,len 大于等于 存储db需要的空间(包含最后的'\0'),返回正常0,database里赋值以'\0‘结尾的db名。

- `int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t fp, void *param, int type)`

设置事件回调函数。

- fp 事件回调函数指针。函数声明:typedef void (*__taos_notify_fn_t)(void *param, void *ext, int type);其中, param 为用户自定义参数,ext 为扩展参数(依赖事件类型,针对 TAOS_NOTIFY_PASSVER 返回用户密码版本),type 为事件类型
- param 用户自定义参数
- type 事件类型。取值范围:1)TAOS_NOTIFY_PASSVER: 用户密码改变

- `void taos_close(TAOS *taos)`

关闭连接,其中`taos`是 `taos_connect()` 返回的句柄。
Expand Down Expand Up @@ -447,6 +461,14 @@ TDengine 的异步 API 均采用非阻塞调用模式。应用程序可以用多

执行准备好的语句。目前,一条语句只能执行一次。

- `int taos_stmt_affected_rows(TAOS_STMT *stmt)`

获取执行多次绑定语句影响的行数。

- `int taos_stmt_affected_rows_once(TAOS_STMT *stmt)`

获取执行一次绑定语句影响的行数。

- `TAOS_RES* taos_stmt_use_result(TAOS_STMT *stmt)`

获取语句的结果集。结果集的使用方式与非参数化调用时一致,使用完成后,应对此结果集调用 `taos_free_result()` 以释放资源。
Expand Down