Jump to content

Validating SQL


ryanh_106

Recommended Posts

Hi, sorry if this is a noddy question but I am pretty new to reg exps

I want to check that an SQL statement is of the form
INSERT INTO table (cols) VALUES (values)
and not
INSERT INTO table (cols) VALUES (values), (morevalues), (moreagain)

i.e. Only one set of values is being used (nobody has injected an extra row in there)

but when I imagine how the regexp would look i can only imagine something like (.*) which could still be "(x), (y), (z)"

How does this work?
Cheers
Ryan
Link to comment
Share on other sites

Where did I say you were wanting them to insetr mysql? I sadi you shoudl not let them - by that I mean your code shoudl be such that youare protected against injection....

So I will accept your apology before you offer it  ;)

There is no point in reasearching what regex you will need to perform thsi task - it will be less efficient and less effective than the already availbe, built for purpose functions.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.