SmartSQL/SmartSQL.DocUtils/JS.cs
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SmartSQL.DocUtils;
using Jint;
namespace SmartSQL.DocUtils
{
public class JS
{
private static Engine jt = null;
static JS()
{
jt = new Engine(cfg =>
{
//cfg.LimitRecursion();
cfg.Strict();
});
jt.SetValue("log", new Action<object>(Console.WriteLine));
var text = string.Empty;
var names = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceNames();
foreach (var name in names)
{
if (Path.GetExtension(name) == ".js")
{
text = System.Reflection.Assembly.GetExecutingAssembly().GetResourceContent(name);
try
{
jt.Execute(text);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}
/// summary>
/// https://zeroturnaround.github.io/sql-formatter/
/// 格式化SQL语句
/// </summary>
/// <param name="sql">SQL语句</param>
/// <param name="dbtype">数据库类型</param>
/// <returns>格式化后的SQL语句</returns>
public static string RunFmtSql(string sql, string dbtype)
{
var supportLang = new List<string>()
{
"sql",
"redshift",
"db2",
"mariadb",
"mysql",
"n1ql",
"plsql",
后面还有 87 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读 AI
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
