-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cleanSql 方法里逻辑是不是有问题 #21
Comments
@LeoMelody 谢谢反馈 |
wewoor
added a commit
that referenced
this issue
May 11, 2021
wewoor
added a commit
that referenced
this issue
May 11, 2021
wewoor
added a commit
that referenced
this issue
May 11, 2021
wewoor
added a commit
that referenced
this issue
May 11, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
/**
*/
function cleanSql(sql: string) {
sql.trim(); // 删除前后空格
const tokens = lexer(sql);
let resultSql = '';
let startIndex = 0;
tokens.forEach((ele: Token) => {
if (ele.type === TokenType.Comment) {
resultSql += sql.slice(startIndex, ele.start);
startIndex = ele.end + 1;
}
});
resultSql += sql.slice(startIndex);
return resultSql;
}
上面删除前后空格这段代码并不会对源sql字段生效的。是不是要改成下面这样
/**
*/
function cleanSql(origiSql: string) {
let sql = origiSql.trim(); // 删除前后空格
const tokens = lexer(sql);
let resultSql = '';
let startIndex = 0;
tokens.forEach((ele: Token) => {
if (ele.type === TokenType.Comment) {
resultSql += sql.slice(startIndex, ele.start);
startIndex = ele.end + 1;
}
});
resultSql += sql.slice(startIndex);
return resultSql;
}
The text was updated successfully, but these errors were encountered: