Lexing partial SQL in C#
- by Chris T
I'd need to parse partial SQL queries (it's for a SQL injection auditing tool). For example
'1' AND 1=1--
Should break down into tokens like
[0] => [SQL_STRING, '1']
[1] => [SQL_AND]
[2] => [SQL_INT, 1]
[3] => [SQL_AND]
[4] => [SQL_INT, 1]
[5] => [SQL_COMMENT]
[6] => [SQL_QUERY_END]
Are their any at least lexers for SQL that I base mine off of or any good tools like bison for C# (though I'd rather not write my own grammar as I need to support most if not all the grammar of MySQL 5)