开发者

regular expression to extract insert sql statement from a text file and to check for hardcoded parameters

I have a bunch of sql statements u开发者_JS百科pdated by my team developers. I intend to run a check before these statements are run against a db. for example, check if a certain column is hardcoded instead of being fetched from the respective table (foreign key)

for example:

INSERT INTO [Term1] ([CreatedBy]

,[CreateUser]) values(1,'asdadad')

where 1 is hardcoded value.

Is there a regular expression that can extract all insert statements from the file so that they can be parse?

I tried with this expression http://regexlib.com/REDetails.aspx?regexp_id=1750 but it didnot work


You may need to run a multi-level regex on this. First parse the entire parameter string from the whole query, then parse each individual field from the paramter string that you previously got to get each one specifically ignoring all the other characters that may come up.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜