From f8c905211a9f0572d11ab1b8fe68753be81ace65 Mon Sep 17 00:00:00 2001 From: freemine Date: Thu, 22 Oct 2020 23:22:46 +0800 Subject: [PATCH] scanner pattern --- src/connector/odbc/src/todbc_scanner.l | 8 +++++--- src/connector/odbc/tests/odbc.py | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/connector/odbc/src/todbc_scanner.l b/src/connector/odbc/src/todbc_scanner.l index e232d4ab2e..8e178aa366 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 2d736ca032..e98110a0d5 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') -- GitLab