formatSql = () => {
    let sqlValue = $("#sql").val();
    let keyword = "select from where and count group by orderby";
    keyword = '(' + keyword.replace(/([\+\.\*\|\?\-\(\[\^\$])/g, '\\$1').replace(/\s+/g, '|') + ')';//把匹配关键字中的正则符转义
    let patt = new RegExp(keyword, 'gi');
    let str = sqlValue.replace(patt, function ($, $1) {
      var upr = $1;
      return upr.toUpperCase();
    });
    let formatteSqlValue = sqlFormatter.format(str);
    $("#sql").val(formatteSqlValue);
    this.setState({repsql: formatteSqlValue});
  }

相关文章:

  • 2021-12-14
  • 2022-12-23
  • 2021-11-18
  • 2021-09-08
  • 2021-05-26
  • 2022-03-07
  • 2022-01-15
  • 2021-07-07
猜你喜欢
  • 2021-05-30
  • 2021-05-30
  • 2022-01-05
  • 2021-05-20
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案