Revert "fix: clea sql white spaces \n fix #21 (#26)" (#28)

This reverts commit b632f62678.
This commit is contained in:
Ziv 2021-05-11 13:37:34 +08:00 committed by GitHub
parent b632f62678
commit bff1618742
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 9 deletions

View File

@ -163,7 +163,7 @@ function splitSql(sql: string) {
* @param {String} sql * @param {String} sql
*/ */
function cleanSql(sql: string) { function cleanSql(sql: string) {
sql = sql.trim(); // 删除前后空格 sql.trim(); // 删除前后空格
const tokens = lexer(sql); const tokens = lexer(sql);
let resultSql = ''; let resultSql = '';
let startIndex = 0; let startIndex = 0;

View File

@ -39,12 +39,4 @@ describe('utils', () => {
const result = cleanSql(sql); const result = cleanSql(sql);
expect(result.indexOf('xxx')).toEqual(-1); expect(result.indexOf('xxx')).toEqual(-1);
}); });
test('clean SQL white spaces', () => {
const sql = `
select * from a; `;
const expected = 'select * from a;';
const result = cleanSql(sql);
expect(result).toEqual(expected);
});
}); });