未验证 提交 d270f1bc 编写于 作者: R robotspace 提交者: GitHub

Do not retrieve err msg when connection is established successfully (#20486)

* Do not retrieve err msg when connection is established successfully to avoid exception.

* Restore check script for lua installation.
上级 3c1c3193
...@@ -4,5 +4,5 @@ if [ "$lua_header_installed" = "0" ]; then ...@@ -4,5 +4,5 @@ if [ "$lua_header_installed" = "0" ]; then
sudo apt install -y liblua5.3-dev sudo apt install -y liblua5.3-dev
fi fi
gcc -std=c99 lua_connector.c -fPIC -shared -o luaconnector.so -Wall -ltaos -I/usr/include/lua5.3 -I../../include/client gcc -g -std=c99 lua_connector.c -fPIC -shared -o luaconnector.so -Wall -ltaos -I/usr/include/lua5.3 -I../../include/client
...@@ -67,7 +67,7 @@ static int l_connect(lua_State *L){ ...@@ -67,7 +67,7 @@ static int l_connect(lua_State *L){
taos = taos_connect(host, user,password,database, port); taos = taos_connect(host, user,password,database, port);
if (taos == NULL) { if (taos == NULL) {
printf("failed to connect server, reason:%s\n", taos_errstr(taos)); //printf("failed to connect server, reason:%s\n", taos_errstr(taos));
lua_pushinteger(L, -1); lua_pushinteger(L, -1);
lua_setfield(L, table_index, "code"); lua_setfield(L, table_index, "code");
...@@ -79,7 +79,7 @@ static int l_connect(lua_State *L){ ...@@ -79,7 +79,7 @@ static int l_connect(lua_State *L){
// printf("success to connect server\n"); // printf("success to connect server\n");
lua_pushinteger(L, 0); lua_pushinteger(L, 0);
lua_setfield(L, table_index, "code"); lua_setfield(L, table_index, "code");
lua_pushstring(L, taos_errstr(taos)); lua_pushstring(L, "success");
lua_setfield(L, table_index, "error"); lua_setfield(L, table_index, "error");
lua_pushlightuserdata(L,taos); lua_pushlightuserdata(L,taos);
lua_setfield(L, table_index, "conn"); lua_setfield(L, table_index, "conn");
......
...@@ -67,8 +67,7 @@ static int l_connect(lua_State *L){ ...@@ -67,8 +67,7 @@ static int l_connect(lua_State *L){
taos = taos_connect(host, user,password,database, port); taos = taos_connect(host, user,password,database, port);
if (taos == NULL) { if (taos == NULL) {
printf("failed to connect server, reason:%s\n", taos_errstr(taos)); // printf("failed to connect server, reason:%s\n", taos_errstr(NULL));
lua_pushinteger(L, -1); lua_pushinteger(L, -1);
lua_setfield(L, table_index, "code"); lua_setfield(L, table_index, "code");
lua_pushstring(L, taos_errstr(taos)); lua_pushstring(L, taos_errstr(taos));
...@@ -79,7 +78,7 @@ static int l_connect(lua_State *L){ ...@@ -79,7 +78,7 @@ static int l_connect(lua_State *L){
// printf("success to connect server\n"); // printf("success to connect server\n");
lua_pushinteger(L, 0); lua_pushinteger(L, 0);
lua_setfield(L, table_index, "code"); lua_setfield(L, table_index, "code");
lua_pushstring(L, taos_errstr(taos)); lua_pushstring(L, "success");
lua_setfield(L, table_index, "error"); lua_setfield(L, table_index, "error");
lua_pushlightuserdata(L,taos); lua_pushlightuserdata(L,taos);
lua_setfield(L, table_index, "conn"); lua_setfield(L, table_index, "conn");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册