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.
This commit is contained in:
parent
3c1c3193ab
commit
d270f1bccc
|
@ -4,5 +4,5 @@ if [ "$lua_header_installed" = "0" ]; then
|
|||
sudo apt install -y liblua5.3-dev
|
||||
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){
|
|||
|
||||
taos = taos_connect(host, user,password,database, port);
|
||||
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_setfield(L, table_index, "code");
|
||||
|
@ -79,7 +79,7 @@ static int l_connect(lua_State *L){
|
|||
// printf("success to connect server\n");
|
||||
lua_pushinteger(L, 0);
|
||||
lua_setfield(L, table_index, "code");
|
||||
lua_pushstring(L, taos_errstr(taos));
|
||||
lua_pushstring(L, "success");
|
||||
lua_setfield(L, table_index, "error");
|
||||
lua_pushlightuserdata(L,taos);
|
||||
lua_setfield(L, table_index, "conn");
|
||||
|
|
|
@ -67,8 +67,7 @@ static int l_connect(lua_State *L){
|
|||
|
||||
taos = taos_connect(host, user,password,database, port);
|
||||
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_setfield(L, table_index, "code");
|
||||
lua_pushstring(L, taos_errstr(taos));
|
||||
|
@ -79,7 +78,7 @@ static int l_connect(lua_State *L){
|
|||
// printf("success to connect server\n");
|
||||
lua_pushinteger(L, 0);
|
||||
lua_setfield(L, table_index, "code");
|
||||
lua_pushstring(L, taos_errstr(taos));
|
||||
lua_pushstring(L, "success");
|
||||
lua_setfield(L, table_index, "error");
|
||||
lua_pushlightuserdata(L,taos);
|
||||
lua_setfield(L, table_index, "conn");
|
||||
|
|
Loading…
Reference in New Issue