From d8bb77810bb54ee4fffca947c7a89763745c1bef Mon Sep 17 00:00:00 2001 From: HSunboy Date: Wed, 25 Sep 2019 15:47:08 +0800 Subject: [PATCH] version 2.0.0 --- lib/lib/flinkParser.js | 3 +++ lib/lib/parser.js | 1 + package.json | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/lib/flinkParser.js b/lib/lib/flinkParser.js index 8fd8ccd..2312fa5 100644 --- a/lib/lib/flinkParser.js +++ b/lib/lib/flinkParser.js @@ -20,6 +20,9 @@ class SqlErrorListener extends error_1.ErrorListener { } } function parserSingle(sql) { + if (!sql || !sql.trim()) { + return null; + } const inputStream = new antlr4.InputStream(sql.toUpperCase()); const lexer = new sqlLexer_1.sqlLexer(inputStream); const tokenStream = new antlr4.CommonTokenStream(lexer); diff --git a/lib/lib/parser.js b/lib/lib/parser.js index 170f1eb..86d9c0e 100644 --- a/lib/lib/parser.js +++ b/lib/lib/parser.js @@ -9,6 +9,7 @@ var sqlType; sqlType["None"] = "sql"; sqlType["Impala"] = "impala"; })(sqlType || (sqlType = {})); +exports.sqlType = sqlType; function sqlToParserArgs(sql) { let preSql = '', sufSql = ''; if (Object.prototype.toString.call(sql) == '[object Array]') { diff --git a/package.json b/package.json index b0e625a..64110be 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dt-sql-parser", - "version": "1.2.1", + "version": "2.0.0", "description": "sql,hive,parser ", "keywords": [ "hive",