diff --git a/docs/en/05-develop/01-connect/01-python.md b/docs/en/05-develop/01-connect/01-python.md
index f01407a3c4ead99fa915ff468268e35157fec8be..c4605fce224d4e39a5f9451520e34a7317e09436 100644
--- a/docs/en/05-develop/01-connect/01-python.md
+++ b/docs/en/05-develop/01-connect/01-python.md
@@ -1,6 +1,7 @@
---
sidebar_label: Python
title: Connect with Python Connector
+pagination_next: develop/insert-data
---
import Tabs from '@theme/Tabs';
@@ -30,14 +31,37 @@ conda install -c conda-forge taospy
## Config
-Run this command in your terminal to save TDengine cloud token as variables:
+Run this command in your terminal to save TDengine cloud token and URL as variables:
+
+
+
```bash
export TDENGINE_CLOUD_TOKEN=
export TDENGINE_CLOUD_URL=
```
-Alternatively, set environment variables in your IDE's run configurations.
+
+
+
+```bash
+set TDENGINE_CLOUD_TOKEN=""
+set TDENGINE_CLOUD_URL=""
+```
+
+
+
+
+```powershell
+$env:TDENGINE_CLOUD_TOKEN=""
+$env:TDENGINE_CLOUD_URL=""
+```
+
+
+
+
+
+Alternatively, you can also set environment variables in your IDE's run configurations.
@@ -50,16 +74,10 @@ To obtain the value of cloud token and URL, please log in [TDengine Cloud](https
## Connect
-Copy code bellow to your editor and run it with `python3` command.
+Copy code bellow to your editor and run it.
```python
-import taosrest
-import os
-
-token = os.environ["TDENGINE_CLOUD_TOKEN"]
-url = os.environ["TDENGINE_ClOUD_URL"]
-
-conn = taosrest.connect(url=url, token=token)
+{{#include docs/examples/python/connect_cloud_example.py:connect}}
```
The client connection is then established. For how to write data and query data, please refer to [sample-program](https://docs.tdengine.com/cloud/connector/python/#sample-program).
diff --git a/docs/en/05-develop/01-connect/02-java.md b/docs/en/05-develop/01-connect/02-java.md
index 9cddca3aedee377b6cfe75bb9292a4522c5649ca..880ab49ec69671ad5fbce9b33a51846dab53a458 100644
--- a/docs/en/05-develop/01-connect/02-java.md
+++ b/docs/en/05-develop/01-connect/02-java.md
@@ -1,6 +1,7 @@
---
sidebar_label: Java
title: Connect with Java Connector
+pagination_next: develop/insert-data
---
import Tabs from '@theme/Tabs';
@@ -36,11 +37,31 @@ dependencies {
Run this command in your terminal to save the JDBC URL as variable:
+
+
+
+
```bash
export TDENGINE_JDBC_URL=
```
+
+
+
+```bash
+set TDENGINE_JDBC_URL=""
+```
+
+
+
+```powershell
+$env:TDENGINE_JDBC_URL=""
+```
+
+
+
+
-Alternatively, set environment variable in your IDE's run configurations.
+Alternatively, you can set environment variable in your IDE's run configurations.
diff --git a/docs/en/05-develop/01-connect/03-go.md b/docs/en/05-develop/01-connect/03-go.md
index 5b5519a8b72013aaeebf0b0f0bffc2e807ea9c98..313ae2aedcc951ecf573e455830a398e80fb1684 100644
--- a/docs/en/05-develop/01-connect/03-go.md
+++ b/docs/en/05-develop/01-connect/03-go.md
@@ -1,8 +1,18 @@
---
sidebar_label: Go
title: Connect with Go Connector
+pagination_next: develop/insert-data
---
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
+## Initialize Project
+
+```
+go mod init tdengine.com/example
+```
+
## Add Dependency
add `driver-go` dependency in `go.mod` .
@@ -15,16 +25,35 @@ go 1.17
require github.com/taosdata/driver-go/v2 develop
```
-Then run command `go mod tidy` in your terminal to download dependencies.
-
## Config
Run this command in your terminal to save DSN(data source name) as variable:
+
+
+
```bash
export TDENGINE_GO_DSN=
```
+
+
+
+```bash
+set TDENGINE_GO_DSN=""
+```
+
+
+
+
+```powershell
+$env:TDENGINE_GO_DSN=""
+```
+
+
+
+
+
:::note
Replace with the real value, the format should be `https()/?token=`.
@@ -35,25 +64,10 @@ To obtain the value of `goDSN`, please log in [TDengine Cloud](https://cloud.tde
## Connect
-```go
-package main
-
-import (
- "database/sql"
- "fmt"
- "os"
-
- _ "github.com/taosdata/driver-go/v2/taosRestful"
-)
-
-func main() {
- dsn := os.Getenv("TDENGINE_GO_DSN")
- taos, err := sql.Open("taosRestful", dsn)
- if err != nil {
- fmt.Println("failed to connect TDengine, err:", err)
- return
- }
- fmt.Println("Connected")
- defer taos.Close()
-}
-```
\ No newline at end of file
+Copy code bellow to main.go.
+
+```go title="main.go"
+{{#include docs/examples/go/connectexample/main.go}}
+```
+
+Then execute `go run main.go` to test the connection.
\ No newline at end of file
diff --git a/docs/en/05-develop/01-connect/04-rust.md b/docs/en/05-develop/01-connect/04-rust.md
index aa494592ce743341928285f0368d450199871115..e03a5beb58325a1defb18936e937712728c693f5 100644
--- a/docs/en/05-develop/01-connect/04-rust.md
+++ b/docs/en/05-develop/01-connect/04-rust.md
@@ -1,6 +1,7 @@
---
sidebar_label: Rust
title: Connect with Rust Connector
+pagination_next: develop/insert-data
---
## Add Dependency
diff --git a/docs/en/05-develop/01-connect/05-node.md b/docs/en/05-develop/01-connect/05-node.md
index bb9ebf9a3524dfd1889319d951aa12a59672354c..8475e50cecfcaeeea556d68d6612e0c83042d2bb 100644
--- a/docs/en/05-develop/01-connect/05-node.md
+++ b/docs/en/05-develop/01-connect/05-node.md
@@ -1,6 +1,7 @@
---
sidebar_label: Node.js
title: Connect with Node.js Connector
+pagination_next: develop/insert-data
---
## Install Connector
diff --git a/docs/en/05-develop/02-model.md b/docs/en/05-develop/02-model.md
deleted file mode 100644
index c2b8b119d76ba8300d89d76772616d18b92bc879..0000000000000000000000000000000000000000
--- a/docs/en/05-develop/02-model.md
+++ /dev/null
@@ -1 +0,0 @@
-# Data Model
\ No newline at end of file
diff --git a/docs/en/06-taos-sql/index.md b/docs/en/06-taos-sql/index.md
deleted file mode 100644
index 33656338a7bba38dc55cf536bdba8e95309c5acf..0000000000000000000000000000000000000000
--- a/docs/en/06-taos-sql/index.md
+++ /dev/null
@@ -1,31 +0,0 @@
----
-title: TDengine SQL
-description: "The syntax supported by TDengine SQL "
----
-
-This section explains the syntax of SQL to perform operations on databases, tables and STables, insert data, select data and use functions. We also provide some tips that can be used in TDengine SQL. If you have previous experience with SQL this section will be fairly easy to understand. If you do not have previous experience with SQL, you'll come to appreciate the simplicity and power of SQL.
-
-TDengine SQL is the major interface for users to write data into or query from TDengine. For ease of use, the syntax is similar to that of standard SQL. However, please note that TDengine SQL is not standard SQL. For instance, TDengine doesn't provide a delete function for time series data and so corresponding statements are not provided in TDengine SQL.
-
-Syntax Specifications used in this chapter:
-
-- The content inside <\> needs to be input by the user, excluding <\> itself.
-- \[ \] means optional input, excluding [] itself.
-- | means one of a few options, excluding | itself.
-- … means the item prior to it can be repeated multiple times.
-
-To better demonstrate the syntax, usage and rules of TAOS SQL, hereinafter it's assumed that there is a data set of data from electric meters. Each meter collects 3 data measurements: current, voltage, phase. The data model is shown below:
-
-```sql
-taos> DESCRIBE meters;
- Field | Type | Length | Note |
-=================================================================================
- ts | TIMESTAMP | 8 | |
- current | FLOAT | 4 | |
- voltage | INT | 4 | |
- phase | FLOAT | 4 | |
- location | BINARY | 64 | TAG |
- groupid | INT | 4 | TAG |
-```
-
-The data set includes the data collected by 4 meters, the corresponding table name is d1001, d1002, d1003 and d1004 based on the data model of TDengine.
diff --git a/docs/en/07-tools/01-cli.md b/docs/en/07-tools/01-cli.md
index 002d91eb015a14056dd4236e3d524cd18c04e1e2..867a6bd76ee440273445d7e966f77e243b99394b 100644
--- a/docs/en/07-tools/01-cli.md
+++ b/docs/en/07-tools/01-cli.md
@@ -13,7 +13,7 @@ The TDengine command-line interface (hereafter referred to as `TDengine CLI`) is
To run TDengine CLI to access TDengine cloud, please install [TDengine client installation package](https://www.taosdata.com/assets-download/TDengine-client-2.6.0.2-Linux-x64.tar.gz) first.
-
+
Run this command in your Linux terminal to save your URL and token as variables:
@@ -34,7 +34,7 @@ set TDENGINE_CLOUD_TOKEN=
```
-
+
Run this command in your Mac terminal to save your URL and token as variables:
@@ -46,7 +46,7 @@ export TDENGINE_CLOUD_TOKEN=
-
+
To access the TDengine Cloud, you can execute below command from a Linux terminal.
diff --git a/docs/examples/.gitignore b/docs/examples/.gitignore
index 7ed6d403bf5f64c0cb230265b4dffee609dea93b..b50ab6c63b6a8968ba92af7d04edb446ec3d2776 100644
--- a/docs/examples/.gitignore
+++ b/docs/examples/.gitignore
@@ -1,3 +1,4 @@
.vscode
*.lock
-.idea
\ No newline at end of file
+.idea
+.env
\ No newline at end of file
diff --git a/docs/examples/.gitignre b/docs/examples/.gitignre
deleted file mode 100644
index 0853156c65c2c6c1b693290e74c3ee630bcaac19..0000000000000000000000000000000000000000
--- a/docs/examples/.gitignre
+++ /dev/null
@@ -1,2 +0,0 @@
-.vscode
-*.lock
\ No newline at end of file
diff --git a/docs/examples/R/connect_native.r b/docs/examples/R/connect_native.r
deleted file mode 100644
index 18c142872be5efaa7167c10a25f62bcb9fbf5a52..0000000000000000000000000000000000000000
--- a/docs/examples/R/connect_native.r
+++ /dev/null
@@ -1,16 +0,0 @@
-if (! "RJDBC" %in% installed.packages()[, "Package"]) {
- install.packages('RJDBC', repos='http://cran.us.r-project.org')
-}
-
-# ANCHOR: demo
-library("DBI")
-library("rJava")
-library("RJDBC")
-
-args<- commandArgs(trailingOnly = TRUE)
-driver_path = args[1] # path to jdbc-driver for example: "/root/taos-jdbcdriver-2.0.37-dist.jar"
-driver = JDBC("com.taosdata.jdbc.TSDBDriver", driver_path)
-conn = dbConnect(driver, "jdbc:TAOS://127.0.0.1:6030/?user=root&password=taosdata")
-dbGetQuery(conn, "SELECT server_version()")
-dbDisconnect(conn)
-# ANCHOR_END: demo
\ No newline at end of file
diff --git a/docs/examples/R/connect_rest.r b/docs/examples/R/connect_rest.r
deleted file mode 100644
index 5ceec572fc26575dfc597983eeac3233bc4488ab..0000000000000000000000000000000000000000
--- a/docs/examples/R/connect_rest.r
+++ /dev/null
@@ -1,12 +0,0 @@
-if (! "RJDBC" %in% installed.packages()[, "Package"]) {
- install.packages('RJDBC', repos='http://cran.us.r-project.org')
-}
-
-library("DBI")
-library("rJava")
-library("RJDBC")
-driver_path = "/home/debug/build/lib/taos-jdbcdriver-2.0.38-dist.jar"
-driver = JDBC("com.taosdata.jdbc.rs.RestfulDriver", driver_path)
-conn = dbConnect(driver, "jdbc:TAOS-RS://localhost:6041?user=root&password=taosdata")
-dbGetQuery(conn, "SELECT server_version()")
-dbDisconnect(conn)
\ No newline at end of file
diff --git a/docs/examples/c/.gitignore b/docs/examples/c/.gitignore
deleted file mode 100644
index afe974314989a1e3aa4eee703738a9a960c18577..0000000000000000000000000000000000000000
--- a/docs/examples/c/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-*
-!*.c
-!.gitignore
diff --git a/docs/examples/c/async_query_example.c b/docs/examples/c/async_query_example.c
deleted file mode 100644
index b370420b124a21b05f8e0b4041fb1461b1e2478a..0000000000000000000000000000000000000000
--- a/docs/examples/c/async_query_example.c
+++ /dev/null
@@ -1,195 +0,0 @@
-// compile with:
-// gcc -o async_query_example async_query_example.c -ltaos
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-typedef int16_t VarDataLenT;
-
-#define TSDB_NCHAR_SIZE sizeof(int32_t)
-#define VARSTR_HEADER_SIZE sizeof(VarDataLenT)
-
-#define GET_FLOAT_VAL(x) (*(float *)(x))
-#define GET_DOUBLE_VAL(x) (*(double *)(x))
-
-#define varDataLen(v) ((VarDataLenT *)(v))[0]
-
-int printRow(char *str, TAOS_ROW row, TAOS_FIELD *fields, int numFields) {
- int len = 0;
- char split = ' ';
-
- for (int i = 0; i < numFields; ++i) {
- if (i > 0) {
- str[len++] = split;
- }
-
- if (row[i] == NULL) {
- len += sprintf(str + len, "%s", "NULL");
- continue;
- }
-
- switch (fields[i].type) {
- case TSDB_DATA_TYPE_TINYINT:
- len += sprintf(str + len, "%d", *((int8_t *)row[i]));
- break;
-
- case TSDB_DATA_TYPE_UTINYINT:
- len += sprintf(str + len, "%u", *((uint8_t *)row[i]));
- break;
-
- case TSDB_DATA_TYPE_SMALLINT:
- len += sprintf(str + len, "%d", *((int16_t *)row[i]));
- break;
-
- case TSDB_DATA_TYPE_USMALLINT:
- len += sprintf(str + len, "%u", *((uint16_t *)row[i]));
- break;
-
- case TSDB_DATA_TYPE_INT:
- len += sprintf(str + len, "%d", *((int32_t *)row[i]));
- break;
-
- case TSDB_DATA_TYPE_UINT:
- len += sprintf(str + len, "%u", *((uint32_t *)row[i]));
- break;
-
- case TSDB_DATA_TYPE_BIGINT:
- len += sprintf(str + len, "%" PRId64, *((int64_t *)row[i]));
- break;
-
- case TSDB_DATA_TYPE_UBIGINT:
- len += sprintf(str + len, "%" PRIu64, *((uint64_t *)row[i]));
- break;
-
- case TSDB_DATA_TYPE_FLOAT: {
- float fv = 0;
- fv = GET_FLOAT_VAL(row[i]);
- len += sprintf(str + len, "%f", fv);
- } break;
-
- case TSDB_DATA_TYPE_DOUBLE: {
- double dv = 0;
- dv = GET_DOUBLE_VAL(row[i]);
- len += sprintf(str + len, "%lf", dv);
- } break;
-
- case TSDB_DATA_TYPE_BINARY:
- case TSDB_DATA_TYPE_NCHAR: {
- int32_t charLen = varDataLen((char *)row[i] - VARSTR_HEADER_SIZE);
- memcpy(str + len, row[i], charLen);
- len += charLen;
- } break;
-
- case TSDB_DATA_TYPE_TIMESTAMP:
- len += sprintf(str + len, "%" PRId64, *((int64_t *)row[i]));
- break;
-
- case TSDB_DATA_TYPE_BOOL:
- len += sprintf(str + len, "%d", *((int8_t *)row[i]));
- default:
- break;
- }
- }
-
- return len;
-}
-
-void printHeader(TAOS_RES *res) {
- int numFields = taos_num_fields(res);
- TAOS_FIELD *fields = taos_fetch_fields(res);
- char header[256] = {0};
- int len = 0;
- for (int i = 0; i < numFields; ++i) {
- len += sprintf(header + len, "%s ", fields[i].name);
- }
- puts(header);
-}
-
-// ANCHOR: demo
-
-/**
- * @brief call back function of taos_fetch_row_a
- *
- * @param param : the third parameter you passed to taos_fetch_row_a
- * @param res : pointer of TAOS_RES
- * @param numOfRow : number of rows fetched in this batch. will be 0 if there is no more data.
- * @return void*
- */
-void *fetch_row_callback(void *param, TAOS_RES *res, int numOfRow) {
- printf("numOfRow = %d \n", numOfRow);
- int numFields = taos_num_fields(res);
- TAOS_FIELD *fields = taos_fetch_fields(res);
- TAOS *_taos = (TAOS *)param;
- if (numOfRow > 0) {
- for (int i = 0; i < numOfRow; ++i) {
- TAOS_ROW row = taos_fetch_row(res);
- char temp[256] = {0};
- printRow(temp, row, fields, numFields);
- puts(temp);
- }
- taos_fetch_rows_a(res, fetch_row_callback, _taos);
- } else {
- printf("no more data, close the connection.\n");
- taos_free_result(res);
- taos_close(_taos);
- taos_cleanup();
- }
-}
-
-/**
- * @brief callback function of taos_query_a
- *
- * @param param: the fourth parameter you passed to taos_query_a
- * @param res : the result set
- * @param code : status code
- * @return void*
- */
-void *select_callback(void *param, TAOS_RES *res, int code) {
- printf("query callback ...\n");
- TAOS *_taos = (TAOS *)param;
- if (code == 0 && res) {
- printHeader(res);
- taos_fetch_rows_a(res, fetch_row_callback, _taos);
- } else {
- printf("failed to execute taos_query. error: %s\n", taos_errstr(res));
- taos_free_result(res);
- taos_close(_taos);
- taos_cleanup();
- exit(EXIT_FAILURE);
- }
-}
-
-int main() {
- TAOS *taos = taos_connect("localhost", "root", "taosdata", "power", 6030);
- if (taos == NULL) {
- puts("failed to connect to server");
- exit(EXIT_FAILURE);
- }
- // param one is the connection returned by taos_connect.
- // param two is the SQL to execute.
- // param three is the callback function.
- // param four can be any pointer. It will be passed to your callback function as the first parameter. we use taos
- // here, because we want to close it after getting data.
- taos_query_a(taos, "SELECT * FROM meters", select_callback, taos);
- sleep(1);
-}
-
-// output:
-// query callback ...
-// ts current voltage phase location groupid
-// numOfRow = 8
-// 1538548685500 11.800000 221 0.280000 california.losangeles 2
-// 1538548696600 13.400000 223 0.290000 california.losangeles 2
-// 1538548685000 10.800000 223 0.290000 california.losangeles 3
-// 1538548686500 11.500000 221 0.350000 california.losangeles 3
-// 1538548685000 10.300000 219 0.310000 california.sanfrancisco 2
-// 1538548695000 12.600000 218 0.330000 california.sanfrancisco 2
-// 1538548696800 12.300000 221 0.310000 california.sanfrancisco 2
-// 1538548696650 10.300000 218 0.250000 california.sanfrancisco 3
-// numOfRow = 0
-// no more data, close the connection.
-// ANCHOR_END: demo
\ No newline at end of file
diff --git a/docs/examples/c/connect_example.c b/docs/examples/c/connect_example.c
deleted file mode 100644
index 1a23df4806d7ff986898734e1971f6e0cd7c5360..0000000000000000000000000000000000000000
--- a/docs/examples/c/connect_example.c
+++ /dev/null
@@ -1,24 +0,0 @@
-// compile with
-// gcc connect_example.c -o connect_example -ltaos
-#include
-#include
-#include "taos.h"
-
-int main() {
- const char *host = "localhost";
- const char *user = "root";
- const char *passwd = "taosdata";
- // if don't want to connect to a default db, set it to NULL or ""
- const char *db = NULL;
- uint16_t port = 0; // 0 means use the default port
- TAOS *taos = taos_connect(host, user, passwd, db, port);
- if (taos == NULL) {
- int errno = taos_errno(NULL);
- char *msg = taos_errstr(NULL);
- printf("%d, %s\n", errno, msg);
- } else {
- printf("connected\n");
- taos_close(taos);
- }
- taos_cleanup();
-}
diff --git a/docs/examples/c/error_handle_example.c b/docs/examples/c/error_handle_example.c
deleted file mode 100644
index e7dedb263df250f6634aa15fab2729cbaf4e5972..0000000000000000000000000000000000000000
--- a/docs/examples/c/error_handle_example.c
+++ /dev/null
@@ -1,24 +0,0 @@
-// compile with
-// gcc error_handle_example.c -o error_handle_example -ltaos
-#include
-#include
-#include "taos.h"
-
-int main() {
- const char *host = "localhost";
- const char *user = "root";
- const char *passwd = "taosdata";
- // if don't want to connect to a default db, set it to NULL or ""
- const char *db = "notexist";
- uint16_t port = 0; // 0 means use the default port
- TAOS *taos = taos_connect(host, user, passwd, db, port);
- if (taos == NULL) {
- int errno = taos_errno(NULL);
- char *msg = taos_errstr(NULL);
- printf("%d, %s\n", errno, msg);
- } else {
- printf("connected\n");
- taos_close(taos);
- }
- taos_cleanup();
-}
diff --git a/docs/examples/c/insert_example.c b/docs/examples/c/insert_example.c
deleted file mode 100644
index ce8fdc5b9372aec7b02d3c9254ec25c4c4f62adc..0000000000000000000000000000000000000000
--- a/docs/examples/c/insert_example.c
+++ /dev/null
@@ -1,51 +0,0 @@
-// compile with
-// gcc -o insert_example insert_example.c -ltaos
-#include
-#include
-#include "taos.h"
-
-
-/**
- * @brief execute sql and print affected rows.
- *
- * @param taos
- * @param sql
- */
-void executeSQL(TAOS *taos, const char *sql) {
- TAOS_RES *res = taos_query(taos, sql);
- int code = taos_errno(res);
- if (code != 0) {
- printf("Error code: %d; Message: %s\n", code, taos_errstr(res));
- taos_free_result(res);
- taos_close(taos);
- exit(EXIT_FAILURE);
- }
- int affectedRows = taos_affected_rows(res);
- printf("affected rows %d\n", affectedRows);
- taos_free_result(res);
-}
-
-
-
-int main() {
- TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 6030);
- if (taos == NULL) {
- printf("failed to connect to server\n");
- exit(EXIT_FAILURE);
- }
- executeSQL(taos, "CREATE DATABASE power");
- executeSQL(taos, "USE power");
- executeSQL(taos, "CREATE STABLE meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (location BINARY(64), groupId INT)");
- executeSQL(taos, "INSERT INTO d1001 USING meters TAGS(California.SanFrancisco, 2) VALUES ('2018-10-03 14:38:05.000', 10.30000, 219, 0.31000) ('2018-10-03 14:38:15.000', 12.60000, 218, 0.33000) ('2018-10-03 14:38:16.800', 12.30000, 221, 0.31000)"
- "d1002 USING meters TAGS(California.SanFrancisco, 3) VALUES ('2018-10-03 14:38:16.650', 10.30000, 218, 0.25000)"
- "d1003 USING meters TAGS(California.LosAngeles, 2) VALUES ('2018-10-03 14:38:05.500', 11.80000, 221, 0.28000) ('2018-10-03 14:38:16.600', 13.40000, 223, 0.29000)"
- "d1004 USING meters TAGS(California.LosAngeles, 3) VALUES ('2018-10-03 14:38:05.000', 10.80000, 223, 0.29000) ('2018-10-03 14:38:06.500', 11.50000, 221, 0.35000)");
- taos_close(taos);
- taos_cleanup();
-}
-
-// output:
-// affected rows 0
-// affected rows 0
-// affected rows 0
-// affected rows 8
\ No newline at end of file
diff --git a/docs/examples/c/json_protocol_example.c b/docs/examples/c/json_protocol_example.c
deleted file mode 100644
index 9d276127a64c3d74322e30587ab2e319c29cbf65..0000000000000000000000000000000000000000
--- a/docs/examples/c/json_protocol_example.c
+++ /dev/null
@@ -1,52 +0,0 @@
-// compile with
-// gcc -o json_protocol_example json_protocol_example.c -ltaos
-#include
-#include
-#include
-#include "taos.h"
-
-void executeSQL(TAOS *taos, const char *sql) {
- TAOS_RES *res = taos_query(taos, sql);
- int code = taos_errno(res);
- if (code != 0) {
- printf("%s\n", taos_errstr(res));
- taos_free_result(res);
- taos_close(taos);
- exit(EXIT_FAILURE);
- }
- taos_free_result(res);
-}
-
-// ANCHOR: main
-int main() {
- TAOS *taos = taos_connect("localhost", "root", "taosdata", "", 6030);
- if (taos == NULL) {
- printf("failed to connect to server\n");
- exit(EXIT_FAILURE);
- }
- executeSQL(taos, "DROP DATABASE IF EXISTS test");
- executeSQL(taos, "CREATE DATABASE test");
- executeSQL(taos, "USE test");
- char *line =
- "[{\"metric\": \"meters.current\", \"timestamp\": 1648432611249, \"value\": 10.3, \"tags\": {\"location\": "
- "\"California.SanFrancisco\", \"groupid\": 2}},{\"metric\": \"meters.voltage\", \"timestamp\": 1648432611249, "
- "\"value\": 219, \"tags\": {\"location\": \"California.LosAngeles\", \"groupid\": 1}},{\"metric\": \"meters.current\", "
- "\"timestamp\": 1648432611250, \"value\": 12.6, \"tags\": {\"location\": \"California.SanFrancisco\", \"groupid\": "
- "2}},{\"metric\": \"meters.voltage\", \"timestamp\": 1648432611250, \"value\": 221, \"tags\": {\"location\": "
- "\"California.LosAngeles\", \"groupid\": 1}}]";
-
- char *lines[] = {line};
- TAOS_RES *res = taos_schemaless_insert(taos, lines, 1, TSDB_SML_JSON_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED);
- if (taos_errno(res) != 0) {
- printf("failed to insert schema-less data, reason: %s\n", taos_errstr(res));
- } else {
- int affectedRow = taos_affected_rows(res);
- printf("successfully inserted %d rows\n", affectedRow);
- }
- taos_free_result(res);
- taos_close(taos);
- taos_cleanup();
-}
-// output:
-// successfully inserted 4 rows
-// ANCHOR_END: main
diff --git a/docs/examples/c/line_example.c b/docs/examples/c/line_example.c
deleted file mode 100644
index ce39f8d9df744082a450ce246529bf56adebd1e0..0000000000000000000000000000000000000000
--- a/docs/examples/c/line_example.c
+++ /dev/null
@@ -1,47 +0,0 @@
-// compile with
-// gcc -o line_example line_example.c -ltaos
-#include
-#include
-#include
-#include "taos.h"
-
-void executeSQL(TAOS *taos, const char *sql) {
- TAOS_RES *res = taos_query(taos, sql);
- int code = taos_errno(res);
- if (code != 0) {
- printf("%s\n", taos_errstr(res));
- taos_free_result(res);
- taos_close(taos);
- exit(EXIT_FAILURE);
- }
- taos_free_result(res);
-}
-
-// ANCHOR: main
-int main() {
- TAOS *taos = taos_connect("localhost", "root", "taosdata", "", 0);
- if (taos == NULL) {
- printf("failed to connect to server\n");
- exit(EXIT_FAILURE);
- }
- executeSQL(taos, "DROP DATABASE IF EXISTS test");
- executeSQL(taos, "CREATE DATABASE test");
- executeSQL(taos, "USE test");
- char *lines[] = {"meters,location=California.LosAngeles,groupid=2 current=11.8,voltage=221,phase=0.28 1648432611249",
- "meters,location=California.LosAngeles,groupid=2 current=13.4,voltage=223,phase=0.29 1648432611250",
- "meters,location=California.LosAngeles,groupid=3 current=10.8,voltage=223,phase=0.29 1648432611249",
- "meters,location=California.LosAngeles,groupid=3 current=11.3,voltage=221,phase=0.35 1648432611250"};
- TAOS_RES *res = taos_schemaless_insert(taos, lines, 4, TSDB_SML_LINE_PROTOCOL, TSDB_SML_TIMESTAMP_MILLI_SECONDS);
- if (taos_errno(res) != 0) {
- printf("failed to insert schema-less data, reason: %s\n", taos_errstr(res));
- } else {
- int affectedRows = taos_affected_rows(res);
- printf("successfully inserted %d rows\n", affectedRows);
- }
- taos_free_result(res);
- taos_close(taos);
- taos_cleanup();
-}
-// output:
-// successfully inserted 4 rows
-// ANCHOR_END: main
\ No newline at end of file
diff --git a/docs/examples/c/multi_bind_example.c b/docs/examples/c/multi_bind_example.c
deleted file mode 100644
index 02e6568e9e88ac8703a4993ed406e770d23c2438..0000000000000000000000000000000000000000
--- a/docs/examples/c/multi_bind_example.c
+++ /dev/null
@@ -1,147 +0,0 @@
-// compile with
-// gcc -o multi_bind_example multi_bind_example.c -ltaos
-#include
-#include
-#include
-#include "taos.h"
-
-/**
- * @brief execute sql only and ignore result set
- *
- * @param taos
- * @param sql
- */
-void executeSQL(TAOS *taos, const char *sql) {
- TAOS_RES *res = taos_query(taos, sql);
- int code = taos_errno(res);
- if (code != 0) {
- printf("%s\n", taos_errstr(res));
- taos_free_result(res);
- taos_close(taos);
- exit(EXIT_FAILURE);
- }
- taos_free_result(res);
-}
-
-/**
- * @brief exit program when error occur.
- *
- * @param stmt
- * @param code
- * @param msg
- */
-void checkErrorCode(TAOS_STMT *stmt, int code, const char *msg) {
- if (code != 0) {
- printf("%s. error: %s\n", msg, taos_stmt_errstr(stmt));
- taos_stmt_close(stmt);
- exit(EXIT_FAILURE);
- }
-}
-
-/**
- * @brief insert data using stmt API
- *
- * @param taos
- */
-void insertData(TAOS *taos) {
- // init
- TAOS_STMT *stmt = taos_stmt_init(taos);
- // prepare
- const char *sql = "INSERT INTO ? USING meters TAGS(?, ?) values(?, ?, ?, ?)";
- int code = taos_stmt_prepare(stmt, sql, 0);
- checkErrorCode(stmt, code, "failed to execute taos_stmt_prepare");
- // bind table name and tags
- TAOS_BIND tags[2];
- char *location = "California.SanFrancisco";
- int groupId = 2;
- tags[0].buffer_type = TSDB_DATA_TYPE_BINARY;
- tags[0].buffer_length = strlen(location);
- tags[0].length = &tags[0].buffer_length;
- tags[0].buffer = location;
- tags[0].is_null = NULL;
-
- tags[1].buffer_type = TSDB_DATA_TYPE_INT;
- tags[1].buffer_length = sizeof(int);
- tags[1].length = &tags[1].buffer_length;
- tags[1].buffer = &groupId;
- tags[1].is_null = NULL;
-
- code = taos_stmt_set_tbname_tags(stmt, "d1001", tags);
- checkErrorCode(stmt, code, "failed to execute taos_stmt_set_tbname_tags");
-
- // highlight-start
- // insert two rows with multi binds
- TAOS_MULTI_BIND params[4];
- // values to bind
- int64_t ts[] = {1648432611249, 1648432611749};
- float current[] = {10.3, 12.6};
- int voltage[] = {219, 218};
- float phase[] = {0.31, 0.33};
- // is_null array
- char is_null[2] = {0};
- // length array
- int32_t int64Len[2] = {sizeof(int64_t)};
- int32_t floatLen[2] = {sizeof(float)};
- int32_t intLen[2] = {sizeof(int)};
-
- params[0].buffer_type = TSDB_DATA_TYPE_TIMESTAMP;
- params[0].buffer_length = sizeof(int64_t);
- params[0].buffer = ts;
- params[0].length = int64Len;
- params[0].is_null = is_null;
- params[0].num = 2;
-
- params[1].buffer_type = TSDB_DATA_TYPE_FLOAT;
- params[1].buffer_length = sizeof(float);
- params[1].buffer = current;
- params[1].length = floatLen;
- params[1].is_null = is_null;
- params[1].num = 2;
-
- params[2].buffer_type = TSDB_DATA_TYPE_INT;
- params[2].buffer_length = sizeof(int);
- params[2].buffer = voltage;
- params[2].length = intLen;
- params[2].is_null = is_null;
- params[2].num = 2;
-
- params[3].buffer_type = TSDB_DATA_TYPE_FLOAT;
- params[3].buffer_length = sizeof(float);
- params[3].buffer = phase;
- params[3].length = floatLen;
- params[3].is_null = is_null;
- params[3].num = 2;
-
- code = taos_stmt_bind_param_batch(stmt, params); // bind batch
- checkErrorCode(stmt, code, "failed to execute taos_stmt_bind_param_batch");
- code = taos_stmt_add_batch(stmt); // add batch
- checkErrorCode(stmt, code, "failed to execute taos_stmt_add_batch");
- // highlight-end
- // execute
- code = taos_stmt_execute(stmt);
- checkErrorCode(stmt, code, "failed to execute taos_stmt_execute");
- int affectedRows = taos_stmt_affected_rows(stmt);
- printf("successfully inserted %d rows\n", affectedRows);
- // close
- taos_stmt_close(stmt);
-}
-
-int main() {
- TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 6030);
- if (taos == NULL) {
- printf("failed to connect to server\n");
- exit(EXIT_FAILURE);
- }
- executeSQL(taos, "DROP DATABASE IF EXISTS power");
- executeSQL(taos, "CREATE DATABASE power");
- executeSQL(taos, "USE power");
- executeSQL(taos,
- "CREATE STABLE meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (location BINARY(64), "
- "groupId INT)");
- insertData(taos);
- taos_close(taos);
- taos_cleanup();
-}
-
-// output:
-// successfully inserted 2 rows
\ No newline at end of file
diff --git a/docs/examples/c/query_example.c b/docs/examples/c/query_example.c
deleted file mode 100644
index fcae95bcd45a282eaa3ae911b4115e6300c6af8e..0000000000000000000000000000000000000000
--- a/docs/examples/c/query_example.c
+++ /dev/null
@@ -1,143 +0,0 @@
-// compile with:
-// gcc -o query_example query_example.c -ltaos
-#include
-#include
-#include
-#include
-#include
-
-typedef int16_t VarDataLenT;
-
-#define TSDB_NCHAR_SIZE sizeof(int32_t)
-#define VARSTR_HEADER_SIZE sizeof(VarDataLenT)
-
-#define GET_FLOAT_VAL(x) (*(float *)(x))
-#define GET_DOUBLE_VAL(x) (*(double *)(x))
-
-#define varDataLen(v) ((VarDataLenT *)(v))[0]
-
-int printRow(char *str, TAOS_ROW row, TAOS_FIELD *fields, int numFields) {
- int len = 0;
- char split = ' ';
-
- for (int i = 0; i < numFields; ++i) {
- if (i > 0) {
- str[len++] = split;
- }
-
- if (row[i] == NULL) {
- len += sprintf(str + len, "%s", "NULL");
- continue;
- }
-
- switch (fields[i].type) {
- case TSDB_DATA_TYPE_TINYINT:
- len += sprintf(str + len, "%d", *((int8_t *)row[i]));
- break;
-
- case TSDB_DATA_TYPE_UTINYINT:
- len += sprintf(str + len, "%u", *((uint8_t *)row[i]));
- break;
-
- case TSDB_DATA_TYPE_SMALLINT:
- len += sprintf(str + len, "%d", *((int16_t *)row[i]));
- break;
-
- case TSDB_DATA_TYPE_USMALLINT:
- len += sprintf(str + len, "%u", *((uint16_t *)row[i]));
- break;
-
- case TSDB_DATA_TYPE_INT:
- len += sprintf(str + len, "%d", *((int32_t *)row[i]));
- break;
-
- case TSDB_DATA_TYPE_UINT:
- len += sprintf(str + len, "%u", *((uint32_t *)row[i]));
- break;
-
- case TSDB_DATA_TYPE_BIGINT:
- len += sprintf(str + len, "%" PRId64, *((int64_t *)row[i]));
- break;
-
- case TSDB_DATA_TYPE_UBIGINT:
- len += sprintf(str + len, "%" PRIu64, *((uint64_t *)row[i]));
- break;
-
- case TSDB_DATA_TYPE_FLOAT: {
- float fv = 0;
- fv = GET_FLOAT_VAL(row[i]);
- len += sprintf(str + len, "%f", fv);
- } break;
-
- case TSDB_DATA_TYPE_DOUBLE: {
- double dv = 0;
- dv = GET_DOUBLE_VAL(row[i]);
- len += sprintf(str + len, "%lf", dv);
- } break;
-
- case TSDB_DATA_TYPE_BINARY:
- case TSDB_DATA_TYPE_NCHAR: {
- int32_t charLen = varDataLen((char *)row[i] - VARSTR_HEADER_SIZE);
- memcpy(str + len, row[i], charLen);
- len += charLen;
- } break;
-
- case TSDB_DATA_TYPE_TIMESTAMP:
- len += sprintf(str + len, "%" PRId64, *((int64_t *)row[i]));
- break;
-
- case TSDB_DATA_TYPE_BOOL:
- len += sprintf(str + len, "%d", *((int8_t *)row[i]));
- default:
- break;
- }
- }
-
- return len;
-}
-
-/**
- * @brief print column name and values of each row
- *
- * @param res
- * @return int
- */
-static int printResult(TAOS_RES *res) {
- int numFields = taos_num_fields(res);
- TAOS_FIELD *fields = taos_fetch_fields(res);
- char header[256] = {0};
- int len = 0;
- for (int i = 0; i < numFields; ++i) {
- len += sprintf(header + len, "%s ", fields[i].name);
- }
- puts(header);
-
- TAOS_ROW row = NULL;
- while ((row = taos_fetch_row(res))) {
- char temp[256] = {0};
- printRow(temp, row, fields, numFields);
- puts(temp);
- }
-}
-
-int main() {
- TAOS *taos = taos_connect("localhost", "root", "taosdata", "power", 6030);
- if (taos == NULL) {
- puts("failed to connect to server");
- exit(EXIT_FAILURE);
- }
- TAOS_RES *res = taos_query(taos, "SELECT * FROM meters LIMIT 2");
- if (taos_errno(res) != 0) {
- printf("failed to execute taos_query. error: %s\n", taos_errstr(res));
- exit(EXIT_FAILURE);
- }
- printResult(res);
- taos_free_result(res);
- taos_close(taos);
- taos_cleanup();
-}
-
-// output:
-// ts current voltage phase location groupid
-// 1648432611249 10.300000 219 0.310000 California.SanFrancisco 2
-// 1648432611749 12.600000 218 0.330000 California.SanFrancisco 2
\ No newline at end of file
diff --git a/docs/examples/c/stmt_example.c b/docs/examples/c/stmt_example.c
deleted file mode 100644
index 28dae5f9d5ea2faec0aa3c0a784d39e252651c65..0000000000000000000000000000000000000000
--- a/docs/examples/c/stmt_example.c
+++ /dev/null
@@ -1,141 +0,0 @@
-// compile with
-// gcc -o stmt_example stmt_example.c -ltaos
-#include
-#include
-#include
-#include "taos.h"
-
-/**
- * @brief execute sql only.
- *
- * @param taos
- * @param sql
- */
-void executeSQL(TAOS *taos, const char *sql) {
- TAOS_RES *res = taos_query(taos, sql);
- int code = taos_errno(res);
- if (code != 0) {
- printf("%s\n", taos_errstr(res));
- taos_free_result(res);
- taos_close(taos);
- exit(EXIT_FAILURE);
- }
- taos_free_result(res);
-}
-
-/**
- * @brief check return status and exit program when error occur.
- *
- * @param stmt
- * @param code
- * @param msg
- */
-void checkErrorCode(TAOS_STMT *stmt, int code, const char* msg) {
- if (code != 0) {
- printf("%s. error: %s\n", msg, taos_stmt_errstr(stmt));
- taos_stmt_close(stmt);
- exit(EXIT_FAILURE);
- }
-}
-
-typedef struct {
- int64_t ts;
- float current;
- int voltage;
- float phase;
-} Row;
-
-/**
- * @brief insert data using stmt API
- *
- * @param taos
- */
-void insertData(TAOS *taos) {
- // init
- TAOS_STMT *stmt = taos_stmt_init(taos);
- // prepare
- const char *sql = "INSERT INTO ? USING meters TAGS(?, ?) VALUES(?, ?, ?, ?)";
- int code = taos_stmt_prepare(stmt, sql, 0);
- checkErrorCode(stmt, code, "failed to execute taos_stmt_prepare");
- // bind table name and tags
- TAOS_BIND tags[2];
- char* location = "California.SanFrancisco";
- int groupId = 2;
- tags[0].buffer_type = TSDB_DATA_TYPE_BINARY;
- tags[0].buffer_length = strlen(location);
- tags[0].length = &tags[0].buffer_length;
- tags[0].buffer = location;
- tags[0].is_null = NULL;
-
- tags[1].buffer_type = TSDB_DATA_TYPE_INT;
- tags[1].buffer_length = sizeof(int);
- tags[1].length = &tags[1].buffer_length;
- tags[1].buffer = &groupId;
- tags[1].is_null = NULL;
-
- code = taos_stmt_set_tbname_tags(stmt, "d1001", tags);
- checkErrorCode(stmt, code, "failed to execute taos_stmt_set_tbname_tags");
-
- // insert two rows
- Row rows[2] = {
- {1648432611249, 10.3, 219, 0.31},
- {1648432611749, 12.6, 218, 0.33},
- };
-
- TAOS_BIND values[4];
- values[0].buffer_type = TSDB_DATA_TYPE_TIMESTAMP;
- values[0].buffer_length = sizeof(int64_t);
- values[0].length = &values[0].buffer_length;
- values[0].is_null = NULL;
-
- values[1].buffer_type = TSDB_DATA_TYPE_FLOAT;
- values[1].buffer_length = sizeof(float);
- values[1].length = &values[1].buffer_length;
- values[1].is_null = NULL;
-
- values[2].buffer_type = TSDB_DATA_TYPE_INT;
- values[2].buffer_length = sizeof(int);
- values[2].length = &values[2].buffer_length;
- values[2].is_null = NULL;
-
- values[3].buffer_type = TSDB_DATA_TYPE_FLOAT;
- values[3].buffer_length = sizeof(float);
- values[3].length = &values[3].buffer_length;
- values[3].is_null = NULL;
-
- for (int i = 0; i < 2; ++i) {
- values[0].buffer = &rows[i].ts;
- values[1].buffer = &rows[i].current;
- values[2].buffer = &rows[i].voltage;
- values[3].buffer = &rows[i].phase;
- code = taos_stmt_bind_param(stmt, values); // bind param
- checkErrorCode(stmt, code, "failed to execute taos_stmt_bind_param");
- code = taos_stmt_add_batch(stmt); // add batch
- checkErrorCode(stmt, code, "failed to execute taos_stmt_add_batch");
- }
- // execute
- code = taos_stmt_execute(stmt);
- checkErrorCode(stmt, code, "failed to execute taos_stmt_execute");
- int affectedRows = taos_stmt_affected_rows(stmt);
- printf("successfully inserted %d rows\n", affectedRows);
- // close
- taos_stmt_close(stmt);
-}
-
-int main() {
- TAOS *taos = taos_connect("localhost", "root", "taosdata", NULL, 6030);
- if (taos == NULL) {
- printf("failed to connect to server\n");
- exit(EXIT_FAILURE);
- }
- executeSQL(taos, "CREATE DATABASE power");
- executeSQL(taos, "USE power");
- executeSQL(taos, "CREATE STABLE meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (location BINARY(64), groupId INT)");
- insertData(taos);
- taos_close(taos);
- taos_cleanup();
-}
-
-
-// output:
-// successfully inserted 2 rows
\ No newline at end of file
diff --git a/docs/examples/c/subscribe_demo.c b/docs/examples/c/subscribe_demo.c
deleted file mode 100644
index 2fe62c24eb92d2f57c24b40fc16f47d62ea5e378..0000000000000000000000000000000000000000
--- a/docs/examples/c/subscribe_demo.c
+++ /dev/null
@@ -1,66 +0,0 @@
-// A simple demo for asynchronous subscription.
-// compile with:
-// gcc -o subscribe_demo subscribe_demo.c -ltaos
-
-#include
-#include
-#include
-#include
-
-int nTotalRows;
-
-/**
- * @brief callback function of subscription.
- *
- * @param tsub
- * @param res
- * @param param. the additional parameter passed to taos_subscribe
- * @param code. error code
- */
-void subscribe_callback(TAOS_SUB* tsub, TAOS_RES* res, void* param, int code) {
- if (code != 0) {
- printf("error: %d\n", code);
- exit(EXIT_FAILURE);
- }
-
- TAOS_ROW row = NULL;
- int num_fields = taos_num_fields(res);
- TAOS_FIELD* fields = taos_fetch_fields(res);
- int nRows = 0;
-
- while ((row = taos_fetch_row(res))) {
- char buf[4096] = {0};
- taos_print_row(buf, row, fields, num_fields);
- puts(buf);
- nRows++;
- }
-
- nTotalRows += nRows;
- printf("%d rows consumed.\n", nRows);
-}
-
-int main() {
- TAOS* taos = taos_connect("localhost", "root", "taosdata", NULL, 6030);
- if (taos == NULL) {
- printf("failed to connect to server\n");
- exit(EXIT_FAILURE);
- }
-
- int restart = 1; // if the topic already exists, where to subscribe from the begin.
- const char* topic = "topic-meter-current-bg-10";
- const char* sql = "select * from power.meters where current > 10";
- void* param = NULL; // additional parameter.
- int interval = 2000; // consumption interval in microseconds.
- TAOS_SUB* tsub = taos_subscribe(taos, restart, topic, sql, subscribe_callback, NULL, interval);
-
- // wait for insert from others process. you can open TDengine CLI to insert some records for test.
-
- getchar(); // press Enter to stop
-
- printf("total rows consumed: %d\n", nTotalRows);
- int keep = 0; // whether to keep subscribe process
- taos_unsubscribe(tsub, keep);
-
- taos_close(taos);
- taos_cleanup();
-}
diff --git a/docs/examples/c/telnet_line_example.c b/docs/examples/c/telnet_line_example.c
deleted file mode 100644
index da62da4ba492856b0d73a564c1bf9cdd60b5b742..0000000000000000000000000000000000000000
--- a/docs/examples/c/telnet_line_example.c
+++ /dev/null
@@ -1,54 +0,0 @@
-// compile with
-// gcc -o telnet_line_example telnet_line_example.c -ltaos
-#include
-#include
-#include
-#include "taos.h"
-
-void executeSQL(TAOS *taos, const char *sql) {
- TAOS_RES *res = taos_query(taos, sql);
- int code = taos_errno(res);
- if (code != 0) {
- printf("%s\n", taos_errstr(res));
- taos_free_result(res);
- taos_close(taos);
- exit(EXIT_FAILURE);
- }
- taos_free_result(res);
-}
-
-// ANCHOR: main
-int main() {
- TAOS *taos = taos_connect("localhost", "root", "taosdata", "", 6030);
- if (taos == NULL) {
- printf("failed to connect to server\n");
- exit(EXIT_FAILURE);
- }
- executeSQL(taos, "DROP DATABASE IF EXISTS test");
- executeSQL(taos, "CREATE DATABASE test");
- executeSQL(taos, "USE test");
- char *lines[] = {
- "meters.current 1648432611249 10.3 location=California.SanFrancisco groupid=2",
- "meters.current 1648432611250 12.6 location=California.SanFrancisco groupid=2",
- "meters.current 1648432611249 10.8 location=California.LosAngeles groupid=3",
- "meters.current 1648432611250 11.3 location=California.LosAngeles groupid=3",
- "meters.voltage 1648432611249 219 location=California.SanFrancisco groupid=2",
- "meters.voltage 1648432611250 218 location=California.SanFrancisco groupid=2",
- "meters.voltage 1648432611249 221 location=California.LosAngeles groupid=3",
- "meters.voltage 1648432611250 217 location=California.LosAngeles groupid=3",
- };
- TAOS_RES *res = taos_schemaless_insert(taos, lines, 8, TSDB_SML_TELNET_PROTOCOL, TSDB_SML_TIMESTAMP_NOT_CONFIGURED);
- if (taos_errno(res) != 0) {
- printf("failed to insert schema-less data, reason: %s\n", taos_errstr(res));
- } else {
- int affectedRow = taos_affected_rows(res);
- printf("successfully inserted %d rows\n", affectedRow);
- }
-
- taos_free_result(res);
- taos_close(taos);
- taos_cleanup();
-}
-// output:
-// successfully inserted 8 rows
-// ANCHOR_END: main
diff --git a/docs/examples/csharp/.gitignore b/docs/examples/csharp/.gitignore
deleted file mode 100644
index b3aff79f3706e23aa74199a7f521f7912d2b0e45..0000000000000000000000000000000000000000
--- a/docs/examples/csharp/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-bin
-obj
-.vs
-*.sln
\ No newline at end of file
diff --git a/docs/examples/csharp/AsyncQueryExample.cs b/docs/examples/csharp/AsyncQueryExample.cs
deleted file mode 100644
index 3dabbebd1630a207af2e1b1b11cc4ba15bdd94a9..0000000000000000000000000000000000000000
--- a/docs/examples/csharp/AsyncQueryExample.cs
+++ /dev/null
@@ -1,238 +0,0 @@
-using TDengineDriver;
-using System.Runtime.InteropServices;
-
-namespace TDengineExample
-{
- public class AsyncQueryExample
- {
- static void Main()
- {
- IntPtr conn = GetConnection();
- QueryAsyncCallback queryAsyncCallback = new QueryAsyncCallback(QueryCallback);
- TDengine.QueryAsync(conn, "select * from meters", queryAsyncCallback, IntPtr.Zero);
- Thread.Sleep(2000);
- TDengine.Close(conn);
- TDengine.Cleanup();
- }
-
- static void QueryCallback(IntPtr param, IntPtr taosRes, int code)
- {
- if (code == 0 && taosRes != IntPtr.Zero)
- {
- FetchRowAsyncCallback fetchRowAsyncCallback = new FetchRowAsyncCallback(FetchRowCallback);
- TDengine.FetchRowAsync(taosRes, fetchRowAsyncCallback, param);
- }
- else
- {
- Console.WriteLine($"async query data failed, failed code {code}");
- }
- }
-
- static void FetchRowCallback(IntPtr param, IntPtr taosRes, int numOfRows)
- {
- if (numOfRows > 0)
- {
- Console.WriteLine($"{numOfRows} rows async retrieved");
- DisplayRes(taosRes);
- TDengine.FetchRowAsync(taosRes, FetchRowCallback, param);
- }
- else
- {
- if (numOfRows == 0)
- {
- Console.WriteLine("async retrieve complete.");
-
- }
- else
- {
- Console.WriteLine($"FetchRowAsync callback error, error code {numOfRows}");
- }
- TDengine.FreeResult(taosRes);
- }
- }
-
- public static void DisplayRes(IntPtr res)
- {
- if (!IsValidResult(res))
- {
- TDengine.Cleanup();
- System.Environment.Exit(1);
- }
-
- List metaList = TDengine.FetchFields(res);
- int fieldCount = metaList.Count;
- // metaList.ForEach((item) => { Console.Write("{0} ({1}) \t|\t", item.name, item.size); });
-
- List