Hello,
I am the creator of rqlite (
https://github.com/rqlite/rqlite), a distributed relational database built on SQLite.
I'm looking for a lexer and parser for SQL -- specifically SQLite, to improve the ease-of-use of rqlite. I've thought about looking into using the C code exposed by the SQLite source itself (which is what
https://github.com/mattn/go-sqlite3 does more generally). But someone might know of a lexer and parser written in Go. I know how to build it myself, but would rather avoid the effort if possible.
What I am really trying to do is to determine, for the end-user, whether the Exec() (
https://golang.org/pkg/database/sql/#DB.Exec) or Query() (
https://golang.org/pkg/database/sql/#DB.Query) method should be called on the standard Go SQL interface, given a user-supplied SQL statement. Right now the user must know what type of statement she is executing, and send the statements to the right endpoint. I'd really like rqlite to just do the right thing, and determine this automatically. Hence my idea to parse the SQLite command, create an AST, and work it out.
Or perhaps there is another way of thinking about this?
Thanks,
Philip