improve doc
This commit is contained in:
parent
ed99f12573
commit
1f6f4df25b
|
@ -22,7 +22,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "taos.h"
|
#include "taos.h"
|
||||||
|
|
||||||
|
|
||||||
static int DemoWithReqId() {
|
static int DemoWithReqId() {
|
||||||
// ANCHOR: with_reqid
|
// ANCHOR: with_reqid
|
||||||
const char *ip = "localhost";
|
const char *ip = "localhost";
|
||||||
|
@ -38,27 +37,10 @@ if (taos == NULL) {
|
||||||
}
|
}
|
||||||
printf("success to connect server %s\n", ip);
|
printf("success to connect server %s\n", ip);
|
||||||
|
|
||||||
// create database
|
|
||||||
TAOS_RES *result = taos_query_with_reqid(taos, "CREATE DATABASE IF NOT EXISTS power", 1L);
|
|
||||||
int code = taos_errno(result);
|
|
||||||
if (code != 0) {
|
|
||||||
printf("failed to create database power, reason: %s\n", taos_errstr(result));
|
|
||||||
taos_free_result(result);
|
|
||||||
taos_close(taos);
|
|
||||||
taos_cleanup();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
taos_free_result(result);
|
|
||||||
printf("success to create database power\n");
|
|
||||||
|
|
||||||
// use database
|
|
||||||
result = taos_query_with_reqid(taos, "USE power", 2L);
|
|
||||||
taos_free_result(result);
|
|
||||||
|
|
||||||
// query data
|
|
||||||
const char *sql = "SELECT ts, current, location FROM power.meters limit 1";
|
const char *sql = "SELECT ts, current, location FROM power.meters limit 1";
|
||||||
result = taos_query_with_reqid(taos, sql, 3L);
|
// query data with reqid
|
||||||
code = taos_errno(result);
|
TAOS_RES *result = taos_query_with_reqid(taos, sql, 3L);
|
||||||
|
int code = taos_errno(result);
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
printf("failed to query data from power.meters, ip: %s, reason: %s\n", ip, taos_errstr(result));
|
printf("failed to query data from power.meters, ip: %s, reason: %s\n", ip, taos_errstr(result));
|
||||||
taos_close(taos);
|
taos_close(taos);
|
||||||
|
@ -92,6 +74,4 @@ return 0;
|
||||||
// ANCHOR_END: with_reqid
|
// ANCHOR_END: with_reqid
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) { return DemoWithReqId(); }
|
||||||
return DemoWithReqId();
|
|
||||||
}
|
|
||||||
|
|
|
@ -273,6 +273,12 @@ URL 和 Properties 的详细参数说明和如何使用详见 [url 规范](../..
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem label="Python" value="python">
|
<TabItem label="Python" value="python">
|
||||||
|
Python 连接器使用 `connect()` 方法来建立连接,下面是连接参数的具体说明:
|
||||||
|
- url: `taosAdapter` REST 服务的 URL。默认是 `localhost` 的 `6041` 端口。
|
||||||
|
- user: TDengine 用户名。默认是 `root`。
|
||||||
|
- password: TDengine 用户密码。默认是 `taosdata`。
|
||||||
|
- timeout: HTTP 请求超时时间。单位为秒。默认为 `socket._GLOBAL_DEFAULT_TIMEOUT`。一般无需配置。
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem label="Go" value="go">
|
<TabItem label="Go" value="go">
|
||||||
|
|
||||||
|
@ -448,7 +454,7 @@ C/C++ 语言连接器使用 `taos_connect()` 函数用于建立与 TDengine 数
|
||||||
```
|
```
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem label="C#" value="csharp">
|
<TabItem label="C#" value="csharp">
|
||||||
```csharp title="WebSocket 连接"
|
```csharp
|
||||||
{{#include docs/examples/csharp/connect/Program.cs:main}}
|
{{#include docs/examples/csharp/connect/Program.cs:main}}
|
||||||
```
|
```
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
Loading…
Reference in New Issue