Skip to content

Commit

Permalink
Use memefish.ParseStatement()
Browse files Browse the repository at this point in the history
  • Loading branch information
apstndb committed Oct 20, 2024
1 parent e6faf66 commit a6a1df7
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
adminpb "cloud.google.com/go/spanner/admin/database/apiv1/databasepb"
pb "cloud.google.com/go/spanner/apiv1/spannerpb"
"github.com/cloudspannerecosystem/memefish"
"github.com/cloudspannerecosystem/memefish/token"
"google.golang.org/api/iterator"
"google.golang.org/grpc/codes"
)
Expand Down Expand Up @@ -1195,7 +1194,7 @@ func logParseStatement(stmt string) {
if !logMemefish {
return
}
n, err := newParser("", stmt).ParseStatement()
n, err := memefish.ParseStatement("", stmt)
if err != nil {
log.Printf("SQL can't parsed as a statement, err: %v", err)
} else {
Expand All @@ -1208,14 +1207,3 @@ func logParseStatements(stmts []string) {
logParseStatement(stmt)
}
}

func newParser(filepath, s string) *memefish.Parser {
return &memefish.Parser{
Lexer: &memefish.Lexer{
File: &token.File{
FilePath: filepath,
Buffer: s,
},
},
}
}

0 comments on commit a6a1df7

Please sign in to comment.