i have a textarea in my project where users can save SQL queries but one of the requirements is to check if this query is valid or not
EXAMPLE
if user entered something like :
SELECT ** FROM EMP 
this should return false and an error message just saying invalid it doesn't have to give any reasons 
mainly the queries will be just select statement 
NOTICE i DON'T want to use any server side at this point
Question
Does any one knows a javascript / jquery library or plugin that have this functionality or any thing similar
i have Google this and it didn't show any thing
Thanks
Here is an example fiddle using the JS SQL Parser:
http://jsfiddle.net/Hb6az/
The parser will throw an error if it hits something unexpected, so you have to wrap your checking code in a try {} catch(error) {} block.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With