You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2022/04/13 10:10:33 UTC
[iotdb] branch master updated: Update the deviceId in c rest example (#5504)
This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 4cf195c2b5 Update the deviceId in c rest example (#5504)
4cf195c2b5 is described below
commit 4cf195c2b534cf573afba28a095bd9d6eae8f696
Author: JiaXin Zhang <37...@users.noreply.github.com>
AuthorDate: Wed Apr 13 18:10:27 2022 +0800
Update the deviceId in c rest example (#5504)
---
example/rest-client-c-example/main.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/example/rest-client-c-example/main.c b/example/rest-client-c-example/main.c
index a4cc748a82..41e28c2340 100644
--- a/example/rest-client-c-example/main.c
+++ b/example/rest-client-c-example/main.c
@@ -50,7 +50,6 @@ void query(char * sql_str) {
fprintf(stderr, "curl_handle == NULL\n");
}
- strcat(authorization1, author);
// set the header
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type:application/json");
@@ -71,7 +70,7 @@ void nonQuery(char* sql_str) {
if (curl_handle == NULL) {
fprintf(stderr, "curl_handle == NULL\n");
}
- strcat(authorization2, author);
+
// set the header
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-Type:application/json");
@@ -92,7 +91,6 @@ void insertTablet(char * sql_str) {
if (curl_handle == NULL) {
fprintf(stderr, "curl_handle == NULL\n");
}
- strcat(authorization3, author);
// set the header
struct curl_slist *headers = NULL;
@@ -111,6 +109,10 @@ void insertTablet(char * sql_str) {
int main() {
author = base64_encode("root:root"); // username:password
printf("%s\n", author);
+ strcat(authorization1, author);
+ strcat(authorization2, author);
+ strcat(authorization3, author);
+
curl_global_init(CURL_GLOBAL_ALL);
ping();
printf("\n");
@@ -118,7 +120,9 @@ int main() {
printf("\n");
nonQuery("{\"sql\":\"set storage group to root.lns\"}");
printf("\n");
- insertTablet("{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\"],\"dataTypes\":[\"INT32\",\"BOOLEAN\"],\"values\":[[11,null],[false,true]],\"isAligned\":false,\"deviceId\":\"root.lns\"}");
-
+ insertTablet("{\"timestamps\":[1635232143960,1635232153960],\"measurements\":[\"s3\",\"s4\"],\"dataTypes\":[\"INT32\",\"BOOLEAN\"],\"values\":[[11,null],[false,true]],\"isAligned\":false,\"deviceId\":\"root.lns.d1\"}");
+ printf("\n");
+ query("{\"sql\":\"select s3, s4 from root.lns.d1\"}");
+ printf("\n");
return 0;
}