lava-oushudb-dt-sql-parser/lib/filter.js
2018-10-08 17:58:36 +08:00

30 lines
588 B
JavaScript

const replaceStrFormIndexArr = require("../utils").replaceStrFormIndexArr;
const commentFilter = require('../core/comment');
/**
* 过滤--注释
* @param {String} sql
*/
function filterComments(sql) {
return commentFilter.parse(sql).text;
}
/**
* 清除注释和前后空格
* @param {String} sql
*/
function cleanSql(sql) {
return filterComments(sql);
}
/**
* 分割sql
* @param {String} sql
*/
function splitSql(sql) {
return commentFilter.parse(sql).lines
}
exports.filterComments = filterComments;
exports.cleanSql = cleanSql;
exports.splitSql = splitSql;