vendredi 22 avril 2016

can I get the table name from sqlite query string?

I have a query string for select statement and I want to separate the table name from the given string using regular expression in javascript. I think when the from word is found then split the next word and return.
Sample query string

var query="select name,age from tbl_name where id='30'";
var query="select name,age from tbl_name;
var query="select * from tbl_name where id='30'";

When you match with above three string it should return the table name "tbl_name"

Aucun commentaire:

Enregistrer un commentaire