lava-oushudb-dt-sql-parser/lib/filter.js
2018-07-06 16:22:57 +08:00

30 lines
600 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} sqlText
*/
function splitSql(sqlText) {
return commentFilter.parse(sqlText).lines
}
exports.filterComments = filterComments;
exports.cleanSql = cleanSql;
exports.splitSql = splitSql;