可以利用RUBY方便的文件操作和正则处理,将SQL语句中关键字小写的地方改为大写,与其他语言相比,其处理更加方便,语句更加简洁

cat FormatSql.rb
while line=gets
    line1=line.gsub(/(select|from|where|sum|having|group|end|case|by)/) {|match| match.upcase}
    puts line1
end

ruby格式化SQL语句

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-04-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2023-03-07
相关资源
相似解决方案