From e79a5a3d07696595449e8dbcaf522956276de4ac Mon Sep 17 00:00:00 2001 From: HSunboy Date: Tue, 4 Jun 2019 17:54:27 +0800 Subject: [PATCH] fix bugs --- lib/lib/parser.js | 3 +++ package.json | 4 ++-- src/lib/parser.ts | 2 ++ test/t.js | 0 4 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 test/t.js diff --git a/lib/lib/parser.js b/lib/lib/parser.js index fa2d80c..170f1eb 100644 --- a/lib/lib/parser.js +++ b/lib/lib/parser.js @@ -15,6 +15,9 @@ function sqlToParserArgs(sql) { preSql = sql[0]; sufSql = sql[1]; } + else { + preSql = sql; + } return [preSql, sufSql]; } /** diff --git a/package.json b/package.json index df0614a..47ffe91 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dt-sql-parser", - "version": "1.2.0", + "version": "1.2.1", "description": "sql,hive,parser ", "keywords": [ "hive", @@ -13,7 +13,7 @@ "build:parse": "pegjs -o core/astParser.js peg/nquery.pegjs ", "build:filter": "pegjs -o core/comment.js peg/comment.pegjs ", "build:syntax": "sh ./jison/hue-sql-syntax.sh ", - "build": "jest && rm -rf lib && tsc", + "build": "rm -rf lib && tsc && jest", "test": "jest" }, "author": "xiaokang", diff --git a/src/lib/parser.ts b/src/lib/parser.ts index 041810d..170a06d 100644 --- a/src/lib/parser.ts +++ b/src/lib/parser.ts @@ -13,6 +13,8 @@ function sqlToParserArgs (sql: sql) { if(Object.prototype.toString.call(sql) == '[object Array]'){ preSql=sql[0]; sufSql=sql[1]; + } else { + preSql = sql as string; } return [preSql, sufSql]; } diff --git a/test/t.js b/test/t.js new file mode 100644 index 0000000..e69de29