未验证 提交 55ee7868 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #2138 from taosdata/hotfix/test

Hotfix/test
...@@ -614,11 +614,8 @@ int taos_stmt_execute(TAOS_STMT* stmt) { ...@@ -614,11 +614,8 @@ int taos_stmt_execute(TAOS_STMT* stmt) {
tfree(pStmt->pSql->sqlstr); tfree(pStmt->pSql->sqlstr);
pStmt->pSql->sqlstr = sql; pStmt->pSql->sqlstr = sql;
SSqlObj* pSql = taos_query((TAOS*)pStmt->taos, pStmt->pSql->sqlstr); SSqlObj* pSql = taos_query((TAOS*)pStmt->taos, pStmt->pSql->sqlstr);
if (pSql != NULL) { ret = taos_errno(pSql);
ret = pSql->res.code; taos_free_result(pSql);
} else {
ret = terrno;
}
} }
} }
return ret; return ret;
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "taos.h" #include "taos.h"
...@@ -14,6 +13,7 @@ int main(int argc, char *argv[]) ...@@ -14,6 +13,7 @@ int main(int argc, char *argv[])
{ {
TAOS *taos; TAOS *taos;
TAOS_RES *result; TAOS_RES *result;
int code;
TAOS_STMT *stmt; TAOS_STMT *stmt;
// connect to server // connect to server
...@@ -31,21 +31,31 @@ int main(int argc, char *argv[]) ...@@ -31,21 +31,31 @@ int main(int argc, char *argv[])
exit(1); exit(1);
} }
taos_query(taos, "drop database demo"); result = taos_query(taos, "drop database demo");
if (taos_query(taos, "create database demo") != 0) { taos_free_result(result);
printf("failed to create database, reason:%s\n", taos_errstr(taos));
result = taos_query(taos, "create database demo");
code = taos_errno(result);
if (code != 0) {
printf("failed to create database, reason:%s\n", taos_errstr(result));
taos_free_result(result);
exit(1); exit(1);
} }
taos_free_result(result);
taos_query(taos, "use demo"); result = taos_query(taos, "use demo");
taos_free_result(result);
// create table // create table
const char* sql = "create table m1 (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, bin binary(40), blob nchar(10))"; const char* sql = "create table m1 (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, bin binary(40), blob nchar(10))";
if (taos_query(taos, sql) != 0) { result = taos_query(taos, sql);
printf("failed to create table, reason:%s\n", taos_errstr(taos)); code = taos_errno(result);
if (code != 0) {
printf("failed to create table, reason:%s\n", taos_errstr(result));
taos_free_result(result);
exit(1); exit(1);
} }
taos_free_result(result);
// sleep for one second to make sure table is created on data node // sleep for one second to make sure table is created on data node
// taosMsleep(1000); // taosMsleep(1000);
...@@ -130,7 +140,7 @@ int main(int argc, char *argv[]) ...@@ -130,7 +140,7 @@ int main(int argc, char *argv[])
int is_null = 1; int is_null = 1;
sql = "insert into m1 values(?,?,?,?,?,?,?,?,?,?)"; sql = "insert into m1 values(?,?,?,?,?,?,?,?,?,?)";
int code = taos_stmt_prepare(stmt, sql, 0); code = taos_stmt_prepare(stmt, sql, 0);
if (code != 0){ if (code != 0){
printf("failed to execute taos_stmt_prepare. code:0x%x\n", code); printf("failed to execute taos_stmt_prepare. code:0x%x\n", code);
} }
...@@ -159,7 +169,6 @@ int main(int argc, char *argv[]) ...@@ -159,7 +169,6 @@ int main(int argc, char *argv[])
exit(1); exit(1);
} }
taos_stmt_close(stmt); taos_stmt_close(stmt);
printf("==== success inset data ====.\n");
// query the records // query the records
stmt = taos_stmt_init(taos); stmt = taos_stmt_init(taos);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册