diff --git a/docs-cn/04-develop/04-query-data/index.mdx b/docs-cn/04-develop/04-query-data/index.mdx index 2185d6a3d81ca8177dc8ff5451e45a8927d5646e..829280fba5b1e5a956b79699df39f9bb2c1cb177 100644 --- a/docs-cn/04-develop/04-query-data/index.mdx +++ b/docs-cn/04-develop/04-query-data/index.mdx @@ -172,7 +172,7 @@ Query OK, 5 row(s) in set (0.001521s) - {/* + - */} + diff --git a/docs-examples/c/async_query_example.c b/docs-examples/c/async_query_example.c index c45e5de39d7da49766e80f935b8cb06b2c14b005..77002891bb4c03f7c7e32b329678e8a124f12a99 100644 --- a/docs-examples/c/async_query_example.c +++ b/docs-examples/c/async_query_example.c @@ -5,6 +5,7 @@ #include #include #include +#include #include typedef int16_t VarDataLenT; @@ -132,6 +133,7 @@ void *fetch_row_callback(void *param, TAOS_RES *res, int numOfRow) { } 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(); @@ -173,7 +175,7 @@ int main() { // 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); - getchar(); + sleep(1); } // output: @@ -189,4 +191,5 @@ int main() { // 1538548685000 10.800000 223 0.290000 beijing.haidian 3 // 1538548686500 11.500000 221 0.350000 beijing.haidian 3 // numOfRow = 0 +// no more data, close the connection. // ANCHOR_END: demo \ No newline at end of file diff --git a/tests/docs-examples-test/test_c.sh b/tests/docs-examples-test/test_c.sh index 520f795f09f66298e6590edac84e7b4ccfab96a5..06813795b952e44f6c031bcdafe7b5e1fb9e8cec 100755 --- a/tests/docs-examples-test/test_c.sh +++ b/tests/docs-examples-test/test_c.sh @@ -11,6 +11,9 @@ cd ../../docs-examples/c gcc connect_example.c -o connect_example -ltaos ./connect_example +gcc -o async_query_example async_query_example.c -ltaos +./async_query_example + # 2 taos -s "drop database if exists power" gcc -o insert_example insert_example.c -ltaos