fix: clean sql white spaces #21
This commit is contained in:
parent
bff1618742
commit
dc49697302
@ -163,7 +163,7 @@ function splitSql(sql: string) {
|
||||
* @param {String} sql
|
||||
*/
|
||||
function cleanSql(sql: string) {
|
||||
sql.trim(); // 删除前后空格
|
||||
sql = sql.trim(); // 删除前后空格
|
||||
const tokens = lexer(sql);
|
||||
let resultSql = '';
|
||||
let startIndex = 0;
|
||||
|
@ -39,4 +39,12 @@ describe('utils', () => {
|
||||
const result = cleanSql(sql);
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user