diff --git a/src/connector/odbc/src/todbc_scanner.l b/src/connector/odbc/src/todbc_scanner.l index e232d4ab2ea714a4d0835072625f8806726ab080..8e178aa366c94d3037d42fa25f0c0b0d1298c70a 100644 --- a/src/connector/odbc/src/todbc_scanner.l +++ b/src/connector/odbc/src/todbc_scanner.l @@ -94,13 +94,15 @@ do { \ .|\n { return -1; } [[:space:]]+ { } -[^][{}(),;?*=!@/\\\n]+ { set_val(); CHG_STATE(VAL); } +[^][{}(),;?*=!@/\\\n[:space:]]+ { set_val(); CHG_STATE(VAL); } [{] { CHG_STATE(BRACE1); } .|\n { return -1; } -[^{}\n]+ { set_val(); CHG_STATE(BRACE2); } +[[:space:]]+ { } +[^{}\n[:space:]]+ { set_val(); CHG_STATE(BRACE2); } .|\n { return -1; } +[[:space:]]+ { } [}] { CHG_STATE(VAL); } .|\n { return -1; } @@ -112,7 +114,7 @@ int todbc_parse_conn_string(const char *conn, char **dsn, char **uid, char **pwd yyscan_t arg = {0}; params_t params = {0}; yylex_init(&arg); - yyset_debug(1, arg); + yyset_debug(0, arg); yyset_extra(¶ms, arg); yy_scan_string(conn, arg); int ret =yylex(arg); diff --git a/src/connector/odbc/tests/odbc.py b/src/connector/odbc/tests/odbc.py index 2d736ca032408b3d58af5ded53d430ee6c1dd4c8..e98110a0d5f5ea2502cd821c858759da9853d703 100644 --- a/src/connector/odbc/tests/odbc.py +++ b/src/connector/odbc/tests/odbc.py @@ -1,5 +1,6 @@ import pyodbc -cnxn = pyodbc.connect('DSN=TAOS_DSN;UID=root;PWD=taosdata;HOST=localhost:6030', autocommit=True) +# cnxn = pyodbc.connect('DSN={TAOS_DSN};UID={ root };PWD={ taosdata };HOST={ localhost:6030 }', autocommit=True) +cnxn = pyodbc.connect('DSN={TAOS_DSN}; UID=root;PWD=taosdata; HOST=localhost:6030', autocommit=True) cnxn.setdecoding(pyodbc.SQL_CHAR, encoding='utf-8') #cnxn.setdecoding(pyodbc.SQL_WCHAR, encoding='utf-8') #cnxn.setencoding(encoding='utf-8')