I am writing a web app which uses SQL as input. This SQL must always be a CREATE TABLE
statement, and what my app needs to do is getting the following attributes from it:
- Field name
- Type
- Length (if available)
- Binary (if available)
- Allow NULL (if available)
- Auto increment (if available)
Example SQL:
CREATE TABLE customer
(First_Name char(50),
Last_Name char(50),
Address char(50),
City char(50),
Country char(25),
Birth_Date date)
I have no idea where to start, and I'm not that good at writing such parsers. Are there any SQL parsers for JavaScript/jQuery that I can use, or any example code? Thanks.