UNO-SOFT / plsql-parser

Go PL/SQL parser using ANTLRv4
Apache License 2.0
11 stars 1 forks source link

Feature Request: Just a demo #1

Open cobolbaby opened 3 years ago

cobolbaby commented 3 years ago

Usage exception:

package main

import (
    "fmt"

    plsqlparser "github.com/UNO-SOFT/plsql-parser"
)

func main() {
    udf := `INSERT INTO tbl1 SELECT * FROM tbl2;`

    p, _ := plsqlparser.ParseToConvertMap(udf)

    fmt.Printf("%#v\n", p)
}
[Running] /usr/local/go/bin/go run "/media/cobolbaby/data/ubuntu/opt/workspace/git/plsql-parser/cmd/plsql-parser/main.go"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4f1b8e]

goroutine 1 [running]:
github.com/UNO-SOFT/plsql-parser/plsql.NewPlSqlLexer({0xdc07f8, 0xc0000e8000})
    /media/cobolbaby/data/ubuntu/opt/workspace/git/plsql-parser/plsql/plsql_lexer.go:15830 +0x10e
github.com/UNO-SOFT/plsql-parser.NewPlSqlLexerParser({0xc0000c2037, 0x1d})
    /media/cobolbaby/data/ubuntu/opt/workspace/git/plsql-parser/antlr.go:45 +0x98
github.com/UNO-SOFT/plsql-parser.ParseToConvertMap({0xd71260, 0x1})
    /media/cobolbaby/data/ubuntu/opt/workspace/git/plsql-parser/antlr.go:63 +0xd7
main.main()
    /media/cobolbaby/data/ubuntu/opt/workspace/git/plsql-parser/cmd/plsql-parser/main.go:14 +0x65
exit status 2

Could you give a simple example? :smile:

RainYuGG commented 4 months ago

So is this repository broken, or is there a specific way to run it?

tgulacsi commented 4 months ago

Yes, does not really work - even the commercial, most used SonarSource's parser fails on a lot of sources :( Nowadays for stored procedures I compile with PLSCOPE_SETTINGS='IDENTIFIERS:ALL' and use the PL/Scope views.