Skip to content

actiontech/java-sql-extractor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

使用方法

// 传递文件进行解析
p, err := parser.CreateJavaParser("/root/javaexample/test/Test7.java")
if err != nil {
    os.Exit(-1)
}

// 生成java解析器的访问者
v := parser.NewJavaVisitor()

// 从跟节点开始访问,并生成自定义的变量树
a:=p.CompilationUnit()
a.Accept(v)

// 从变量树中根据jdbc运行sql的函数获取sql
fmt.Println(parser.GetSqlsFromVisitor(v))

/*
delete from t1;
select BYTES from user_segments where segment_name =?
*/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published